Repository navigation
chore(deps): bump actions/stale from 9 to 11 #5
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: PR auto-assign | ||
|
Check warning on line 1 in .github/workflows/pr-auto-assign.yml
|
||
| # Assigns the PR author (optional) and requests review from the maintainers team | ||
| # when a pull request is opened or reopened. | ||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, ready_for_review] | ||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
| jobs: | ||
| auto-assign: | ||
| name: Assign & request reviewers | ||
| runs-on: ubuntu-latest | ||
| # Skip Dependabot / bots and draft PRs for review requests still allowed on ready_for_review | ||
| if: ${{ github.event.pull_request.user.type != 'Bot' }} | ||
| steps: | ||
| - name: Assign PR author | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pr = context.payload.pull_request; | ||
| const author = pr.user.login; | ||
| // Optional: assign the author so they stay on the PR (skipped if already assigned) | ||
| const assignees = (pr.assignees || []).map(a => a.login); | ||
| if (!assignees.includes(author)) { | ||
| await github.rest.issues.addAssignees({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: pr.number, | ||
| assignees: [author], | ||
| }); | ||
| core.info(`Assigned author: ${author}`); | ||
| } else { | ||
| core.info(`Author already assigned: ${author}`); | ||
| } | ||
| - name: Request maintainers review | ||
| if: ${{ github.event.pull_request.draft == false }} | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pr = context.payload.pull_request; | ||
| const team_slug = 'maintainers'; | ||
| try { | ||
| await github.rest.pulls.requestReviewers({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: pr.number, | ||
| team_reviewers: [team_slug], | ||
| }); | ||
| core.info(`Requested review from @${context.repo.owner}/${team_slug}`); | ||
| } catch (err) { | ||
| // Common on forks / missing team permissions — do not fail the workflow hard | ||
| core.warning(`Could not request team reviewers: ${err.message}`); | ||
| } | ||