Skip to content

feat(skills): timers-modal-and-threading skill, snippet and example #349

feat(skills): timers-modal-and-threading skill, snippet and example

feat(skills): timers-modal-and-threading skill, snippet and example #349

Workflow file for this run

name: Label PRs
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
label:
name: Auto-label by path
# A fork PR's GITHUB_TOKEN is read-only whatever `permissions:` says, so
# `gh pr edit` would 403 and fail this check, and release-gate.sh refuses
# to release a merge whose PR has a failed check. Skip forks; labels are
# cosmetic. No checkout: every step talks to the API only.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
steps:
- name: Get changed files
id: changed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The files endpoint lists paths only. `gh pr diff --name-only` fetches the
# whole diff first and fails with HTTP 406 past 20,000 lines, which a
# full docs/gallery regeneration exceeds (#300).
run: |
FILES=$(gh api --paginate "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --jq '.[].filename')
echo "files<<EOF" >> "$GITHUB_OUTPUT"
echo "$FILES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Apply labels
env:
FILES: ${{ steps.changed.outputs.files }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LABELS=""
if echo "$FILES" | grep -q "^skills/"; then
LABELS="$LABELS skills"
fi
if echo "$FILES" | grep -q "^rules/"; then
LABELS="$LABELS rules"
fi
if echo "$FILES" | grep -q "^snippets/"; then
LABELS="$LABELS snippets"
fi
if echo "$FILES" | grep -q "^templates/"; then
LABELS="$LABELS templates"
fi
if echo "$FILES" | grep -q "^examples/"; then
LABELS="$LABELS examples"
fi
if echo "$FILES" | grep -q "^showcase/"; then
LABELS="$LABELS showcase"
fi
if echo "$FILES" | grep -qE "(README\.md|AGENTS\.md|CLAUDE\.md|ROADMAP\.md|CHANGELOG\.md|^docs/)"; then
LABELS="$LABELS documentation"
fi
if echo "$FILES" | grep -q "^\.github/"; then
LABELS="$LABELS ci"
fi
if [ -n "$LABELS" ]; then
for label in $LABELS; do
# No --force: it would reset an existing label's colour and description.
gh label create "$label" --color "ededed" 2>/dev/null || true
gh pr edit ${{ github.event.pull_request.number }} --add-label "$label"
done
echo "Applied labels:$LABELS"
else
echo "No labels to apply"
fi