@@ -13,10 +13,17 @@ jobs:
1313 runs-on : ubuntu-latest
1414 steps :
1515 # Use the @nf-core-bot token to check out so we can push later
16- - uses : actions/checkout@v3
16+ - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1717 with :
1818 token : ${{ secrets.nf_core_bot_auth_token }}
1919
20+ # indication that the linting is being fixed
21+ - name : React on comment
22+ uses : peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
23+ with :
24+ comment-id : ${{ github.event.comment.id }}
25+ reactions : eyes
26+
2027 # Action runs on the issue comment, so we don't get the PR by default
2128 # Use the gh cli to check out the PR
2229 - name : Checkout Pull Request
@@ -25,14 +32,64 @@ jobs:
2532 GITHUB_TOKEN : ${{ secrets.nf_core_bot_auth_token }}
2633
2734 # Install and run pre-commit
28- - uses : actions/setup-python@v3
29- -
uses :
pre-commit/[email protected] 35+ - uses : actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
36+ with :
37+ python-version : 3.11
38+
39+ # install prettier plugins
40+ - uses : actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4
41+ with :
42+ node-version : 20
43+ - run : npm install --only=dev
44+
45+ - name : Install pre-commit
46+ run : pip install pre-commit
47+
48+ - name : Run pre-commit
49+ id : pre-commit
50+ run : pre-commit run --all-files
51+ continue-on-error : true
52+
53+ # indication that the linting has finished
54+ - name : react if linting finished succesfully
55+ if : steps.pre-commit.outcome == 'success'
56+ uses : peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
57+ with :
58+ comment-id : ${{ github.event.comment.id }}
59+ reactions : ' +1'
3060
3161 - name : Commit & push changes
32- if : steps.prettier_status.outputs.result == 'fail'
62+ id : commit-and-push
63+ if : steps.pre-commit.outcome == 'failure'
3364 run : |
3465 git config user.email "[email protected] " 3566 git config user.name "nf-core-bot"
3667 git config push.default upstream
68+ git add .
3769 git status
38- git diff --quiet || (git commit -am "[automated] Fix linting with Prettier" && git push)
70+ git commit -m "[automated] Fix code linting"
71+ git push
72+
73+ - name : react if linting errors were fixed
74+ id : react-if-fixed
75+ if : steps.commit-and-push.outcome == 'success'
76+ uses : peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
77+ with :
78+ comment-id : ${{ github.event.comment.id }}
79+ reactions : hooray
80+
81+ - name : react if linting errors were not fixed
82+ if : steps.commit-and-push.outcome == 'failure'
83+ uses : peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
84+ with :
85+ comment-id : ${{ github.event.comment.id }}
86+ reactions : confused
87+
88+ - name : react if linting errors were not fixed
89+ if : steps.commit-and-push.outcome == 'failure'
90+ uses : peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
91+ with :
92+ issue-number : ${{ github.event.issue.number }}
93+ body : |
94+ @${{ github.actor }} I tried to fix the linting errors, but it didn't work. Please fix them manually.
95+ See [CI log](https://github.com/nf-core/website/actions/runs/${{ github.run_id }}) for more details.
0 commit comments