Repository navigation
feat(ci): Create PRs with ruff fixes automatically #2
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: Close Ruff Auto-fix PR | |
| on: | |
| pull_request: | |
| types: [closed] | |
| jobs: | |
| close-autofix-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Close matching Ruff auto-fix PR | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const sourcePrNumber = context.payload.pull_request.number; | |
| const head = `${owner}:ci/ruff-autofix/pr-${sourcePrNumber}`; | |
| const { data: pulls } = await github.rest.pulls.list({ | |
| owner, | |
| repo, | |
| state: "open", | |
| head, | |
| per_page: 100, | |
| }); | |
| for (const pr of pulls) { | |
| await github.rest.pulls.update({ | |
| owner, | |
| repo, | |
| pull_number: pr.number, | |
| state: "closed", | |
| }); | |
| } |