mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
The area-labels workflow listed open PRs with -L 200, so with more than 200 open PRs the older ones never entered the todo list and never got their area labels (#3295 changes libkernel and has no libkernel label). List up to 1000; the head -n 40 cap still bounds labeler work per run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zyXkUzTZGh3nBwNMtrLaW
48 lines
1.9 KiB
YAML
48 lines
1.9 KiB
YAML
name: Area labels
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '30 * * * *'
|
|
workflow_dispatch:
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
label:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/cache/restore@v6
|
|
with:
|
|
path: ${{ runner.temp }}/area-state.json
|
|
key: area-labels-${{ github.run_id }}
|
|
restore-keys: area-labels-
|
|
- id: prs
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
state=$RUNNER_TEMP/area-state.json
|
|
[ -s "$state" ] || echo '{}' > "$state"
|
|
config=$(gh api "repos/$GITHUB_REPOSITORY/contents/.github/labeler.yml" --jq .sha)
|
|
gh pr list -R "$GITHUB_REPOSITORY" --base "${{ github.event.repository.default_branch }}" -L 1000 --json number,headRefOid \
|
|
--jq "map({key: (.number | tostring), value: (.headRefOid + \"-$config\")}) | from_entries" > "$RUNNER_TEMP/area-open.json"
|
|
jq -r --slurpfile old "$state" 'to_entries[] | select($old[0][.key] != .value) | .key' "$RUNNER_TEMP/area-open.json" | head -n 40 > "$RUNNER_TEMP/area-todo"
|
|
jq -c --slurpfile open "$RUNNER_TEMP/area-open.json" --rawfile todo "$RUNNER_TEMP/area-todo" \
|
|
'with_entries(select(.key | in($open[0]))) + ($open[0] | with_entries(select(.key | IN($todo | split("\n")[]))))' "$state" > "$RUNNER_TEMP/area-next.json"
|
|
{
|
|
echo 'numbers<<EOF'
|
|
cat "$RUNNER_TEMP/area-todo"
|
|
echo EOF
|
|
} >> "$GITHUB_OUTPUT"
|
|
- if: steps.prs.outputs.numbers != ''
|
|
uses: actions/labeler@v7
|
|
with:
|
|
pr-number: ${{ steps.prs.outputs.numbers }}
|
|
- run: mv "$RUNNER_TEMP/area-next.json" "$RUNNER_TEMP/area-state.json"
|
|
- uses: actions/cache/save@v6
|
|
with:
|
|
path: ${{ runner.temp }}/area-state.json
|
|
key: area-labels-${{ github.run_id }}
|