-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split autofixes into its own workflow
- Loading branch information
1 parent
2dd0756
commit d463d1c
Showing
5 changed files
with
54 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: PR Autofixes | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
Autofixes: | ||
runs-on: unbuntu-latest | ||
# Only run autofixes on PRs | ||
if: ${{ github.event_name == 'pull_request' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
# Token with Contents permissions to allow retriggering workflow | ||
token: ${{ secrets.PR_AUTOFIX_PAT }} | ||
|
||
# Ruff autofixes | ||
- run: cd canopeum_backend | ||
- uses: astral-sh/ruff-action@v1 | ||
# Fix even on other steps failure | ||
if: ${{ !cancelled() }} | ||
with: | ||
args: check --fix | ||
- uses: astral-sh/ruff-action@v1 | ||
# Format even on lint failure | ||
if: ${{ !cancelled() }} | ||
with: | ||
args: format | ||
|
||
# ESLint & Dprint autofixes | ||
- run: cd ../canopeum_frontend | ||
- run: npm run lint:fix | ||
# Fix even on other steps failure | ||
if: ${{ !cancelled() }} | ||
|
||
- name: Commit autofixes | ||
uses: EndBug/add-and-commit@v9 | ||
# TODO: Prevent infinite loops, github.event.head_commit.author.name is not accessible in this context | ||
# if: ${{ github.event.head_commit.author.name != 'github-actions' }} | ||
# Push autofixes even on failure | ||
if: ${{ !cancelled() }} | ||
with: | ||
default_author: github_actions |