@@ -15,46 +15,53 @@ jobs:
1515 arg1 : ${{ steps.command.outputs.arg1 }}
1616 arg2 : ${{ steps.command.outputs.arg2 }}
1717 head_ref : ${{ steps.comment-branch.outputs.head_ref }}
18+ base_ref : ${{ steps.comment-branch.outputs.base_ref }}
1819
1920 steps :
2021 - name : Check actor permission
21- uses : skjnldsv/check-actor-permission@v2
22+ uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2223 with :
2324 require : write
2425
2526 - name : Add reaction on start
26- uses : peter-evans/create-or-update-comment@v1
27+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
2728 with :
2829 token : ${{ secrets.COMMAND_BOT_PAT }}
2930 repository : ${{ github.event.repository.full_name }}
3031 comment-id : ${{ github.event.comment.id }}
31- reaction-type : " +1"
32+ reactions : " +1"
3233
3334 - name : Parse command
34- uses : skjnldsv/parse-command-comment@master
35+ uses : skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
3536 id : command
3637
3738 # Init path depending on which command is run
3839 - name : Init path
3940 id : git-path
40- run : |
41+ run : |
4142 if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
42- echo "::set-output name= path:: ${{ github.workspace }}${{ steps.command.outputs.arg1}}"
43+ echo "path= ${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
4344 else
44- echo "::set-output name= path:: ${{ github.workspace }}${{ steps.command.outputs.arg2}}"
45+ echo "path= ${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
4546 fi
4647
4748 - name : Init branch
48- uses : xt0rted/pull-request-comment-branch@v1
49+ uses : xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
4950 id : comment-branch
50-
51+
5152 process :
5253 runs-on : ubuntu-latest
5354 needs : init
5455
5556 steps :
57+ - name : Restore cached git repository
58+ uses : buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
59+ with :
60+ path : .git
61+ key : git-repo
62+
5663 - name : Checkout ${{ needs.init.outputs.head_ref }}
57- uses : actions/checkout@v3
64+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5865 with :
5966 token : ${{ secrets.COMMAND_BOT_PAT }}
6067 fetch-depth : 0
@@ -66,52 +73,68 @@ jobs:
6673 git config --local user.name "nextcloud-command"
6774
6875 - name : Read package.json node and npm engines version
69- uses : skjnldsv/read-package-engines-version-actions@v1 .2
76+ uses : skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2 .2
7077 id : package-engines-versions
7178 with :
72- fallbackNode : ' ^12 '
73- fallbackNpm : ' ^6 '
79+ fallbackNode : ' ^20 '
80+ fallbackNpm : ' ^10 '
7481
7582 - name : Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
76- uses : actions/setup-node@v3
83+ uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
7784 with :
7885 node-version : ${{ steps.package-engines-versions.outputs.nodeVersion }}
7986 cache : npm
8087
8188 - name : Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
8289 run : npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
90+
91+ - name : Rebase to ${{ needs.init.outputs.base_ref }}
92+ if : ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93+ run : |
94+ git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95+ git rebase origin/${{ needs.init.outputs.base_ref }}
8396
8497 - name : Install dependencies & build
98+ env :
99+ CYPRESS_INSTALL_BINARY : 0
100+ PUPPETEER_SKIP_DOWNLOAD : true
85101 run : |
86102 npm ci
87103 npm run build --if-present
88104
89- - name : Commit and push default
90- if : ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
105+ - name : Commit default
106+ if : ${{ !contains( needs.init.outputs.arg1, 'fixup') && !contains( needs.init.outputs.arg1, 'amend') }}
91107 run : |
92- git add ${{ needs.init.outputs.git_path }}
93- git commit --signoff -m 'Compile assets'
94- git push origin ${{ needs.init.outputs.head_ref }}
95-
96- - name : Commit and push fixup
97- if : ${{ needs.init.outputs.arg1 == 'fixup' }}
108+ git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
109+ git commit --signoff -m 'chore(assets): Recompile assets'
110+
111+ - name : Commit fixup
112+ if : ${{ contains(needs.init.outputs.arg1, 'fixup') }}
98113 run : |
99- git add ${{ needs.init.outputs.git_path }}
114+ git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
100115 git commit --fixup=HEAD --signoff
101- git push origin ${{ needs.init.outputs.head_ref }}
102116
103- - name : Commit and push amend
104- if : ${{ needs.init.outputs.arg1 == 'amend' }}
117+ - name : Commit amend
118+ if : ${{ contains( needs.init.outputs.arg1, 'amend') }}
105119 run : |
106- git add ${{ needs.init.outputs.git_path }}
120+ git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
107121 git commit --amend --no-edit --signoff
108- git push --force origin ${{ needs.init.outputs.head_ref }}
122+ # Remove any [skip ci] from the amended commit
123+ git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124+
125+ - name : Push normally
126+ if : ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127+ run : git push origin ${{ needs.init.outputs.head_ref }}
128+
129+ - name : Force push
130+ if : ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131+ run : git push --force origin ${{ needs.init.outputs.head_ref }}
109132
110133 - name : Add reaction on failure
111- uses : peter-evans/create-or-update-comment@v1
134+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
112135 if : failure()
113136 with :
114137 token : ${{ secrets.COMMAND_BOT_PAT }}
115138 repository : ${{ github.event.repository.full_name }}
116139 comment-id : ${{ github.event.comment.id }}
117- reaction-type : " -1"
140+ reactions : " -1"
0 commit comments