Refactor PDPv0 PullPiece scheduling, parking, and backpressure #594
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Label PDP Issues and PRs | |
| on: | |
| issues: | |
| types: | |
| - opened | |
| - edited | |
| pull_request_target: | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| jobs: | |
| label-pdp: | |
| name: Add team/fs-wg label to PDP issues and PRs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: Check title and changed files and add label | |
| uses: actions/github-script@v7 | |
| with: | |
| # A PAT is used instead of the default GITHUB_TOKEN because events triggered | |
| # by GITHUB_TOKEN do not cascade to trigger other workflows. Using a PAT allows | |
| # the label event emitted here to trigger add-issues-and-prs-to-fs-project-board.yml. | |
| github-token: ${{ secrets.FILOZZY_CI_ADD_TO_PROJECT }} | |
| script: | | |
| const title = context.payload.issue?.title || context.payload.pull_request?.title || ''; | |
| const body = context.payload.issue?.body || context.payload.pull_request?.body || ''; | |
| const number = context.payload.issue?.number || context.payload.pull_request?.number; | |
| const normalizedTitle = title.toLowerCase(); | |
| const normalizedBody = body.toLowerCase(); | |
| const titleMatches = normalizedTitle.includes('pdp'); | |
| const bodyMatches = normalizedBody.includes('pdp'); | |
| let hasPdpFilePath = false; | |
| if (context.eventName === 'pull_request_target' && context.payload.pull_request?.number) { | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| per_page: 100 | |
| }); | |
| hasPdpFilePath = files.some((file) => file.filename.toLowerCase().includes('pdp')); | |
| } | |
| if (titleMatches || bodyMatches || hasPdpFilePath) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: number, | |
| labels: ['team/fs-wg'] | |
| }); | |
| console.log(`Added team/fs-wg label to #${number}`); | |
| } else { | |
| console.log(`No PDP match for #${number} (title, body, or file paths)`); | |
| } |