@@ -38,24 +38,56 @@ jobs:
3838 id : comment-branch
3939
4040 - name : Checkout ${{ steps.comment-branch.outputs.head_ref }}
41- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
41+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4242 with :
43+ persist-credentials : false
4344 fetch-depth : 0
4445 token : ${{ secrets.COMMAND_BOT_PAT }}
4546 ref : ${{ steps.comment-branch.outputs.head_ref }}
4647
48+ - name : Register server reference to fallback to master branch
49+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
50+ with :
51+ github-token : ${{secrets.GITHUB_TOKEN}}
52+ script : |
53+ const baseRef = context.payload.pull_request.base.ref
54+ if (baseRef === 'main' || baseRef === 'master') {
55+ core.exportVariable('server_ref', 'master');
56+ console.log('Setting server_ref to master');
57+ } else {
58+ const regex = /^stable(\d+)$/
59+ const match = baseRef.match(regex)
60+ if (match) {
61+ core.exportVariable('server_ref', match[0]);
62+ console.log('Setting server_ref to ' + match[0]);
63+ } else {
64+ console.log('Not based on master/main/stable*, so skipping freeze check');
65+ }
66+ }
67+
4768 - name : Setup git
4869 run : |
4970 git config --local user.email '[email protected] ' 5071 git config --local user.name 'nextcloud-command'
5172
73+ - name : Add reaction on failure
74+ uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v3.0.1
75+ if : ${{ env.server_ref == '' }}
76+ with :
77+ token : ${{ secrets.COMMAND_BOT_PAT }}
78+ repository : ${{ github.event.repository.full_name }}
79+ comment-id : ${{ github.event.comment.id }}
80+ reactions : ' -1'
81+
5282 - name : Pull 3rdparty
53- run : git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin '"'"'${{ github.event.issue.pull_request.base.ref }}'"'"'; fi'
83+ if : ${{ env.server_ref != '' }}
84+ run : git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin '"'"'${{ env.server_ref }}'"'"'; fi'
5485
5586 - name : Commit and push changes
87+ if : ${{ env.server_ref != '' }}
5688 run : |
5789 git add 3rdparty
58- git commit -s -m 'Update submodule 3rdparty to latest ${{ github.event.issue.pull_request.base.ref }}'
90+ git commit -s -m 'Update submodule 3rdparty to latest ${{ env.server_ref }}'
5991 git push
6092
6193 - name : Add reaction on failure
0 commit comments