chore(deps): update dependency ruff to v0.16.0 #180
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: "Auto Link Issues in PR" | |
| on: | |
| pull_request_target: | |
| types: [opened, edited] | |
| jobs: | |
| link-issues: | |
| runs-on: ubuntu-latest | |
| # Skip for bot accounts (renovate, dependabot, etc.) | |
| if: | | |
| github.actor != 'renovate[bot]' && | |
| github.actor != 'dependabot[bot]' && | |
| !contains(github.actor, '[bot]') | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Check for linked issues | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const pr = context.payload.pull_request; | |
| const body = pr.body || ''; | |
| // Check if PR links to an issue | |
| const issuePattern = /(close[sd]?|fix(e[sd])?|resolve[sd]?)\s+#(\d+)/gi; | |
| const hasLinkedIssue = issuePattern.test(body); | |
| if (!hasLinkedIssue) { | |
| // Check if warning comment already exists | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('π‘ Tip: Link this PR to an issue') | |
| ); | |
| if (!botComment) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| body: 'π‘ **Tip: Link this PR to an issue!**\n\n' + | |
| 'We noticed this PR doesn\'t link to any issue. Linking helps us:\n' + | |
| '- Track which issues are being worked on\n' + | |
| '- Automatically close issues when PRs are merged\n' + | |
| '- Keep our project organized\n\n' + | |
| '**How to link:**\n' + | |
| 'Add one of these keywords to your PR description:\n' + | |
| '- `Fixes #123` - Closes issue when merged\n' + | |
| '- `Closes #123` - Closes issue when merged\n' + | |
| '- `Resolves #123` - Closes issue when merged\n' + | |
| '- `Related to #123` - Just references (doesn\'t close)\n\n' + | |
| '**No related issue?**\n' + | |
| 'That\'s okay! But consider:\n' + | |
| '- Checking if an issue already exists for this change\n' + | |
| '- Creating an issue first to discuss the approach\n' + | |
| '- Adding a clear explanation of why this change is needed\n\n' + | |
| 'Thanks for contributing! π' | |
| }); | |
| } | |
| } |