Skip to content

Commit c3da283

Browse files
Merge pull request #53110 from nextcloud/ci/noid/syncActions30
[stable30] Sync workflow updates
2 parents 58bdf17 + b79244c commit c3da283

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+430
-163
lines changed

.github/workflows/block-merge-eol.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@ jobs:
2727

2828
steps:
2929
- name: Set server major version environment
30-
run: |
31-
# retrieve version number from branch reference
32-
server_major=$(echo "${{ github.base_ref }}" | sed -En 's/stable//p')
33-
echo "server_major=$server_major" >> $GITHUB_ENV
34-
echo "current_month=$(date +%Y-%m)" >> $GITHUB_ENV
35-
36-
- name: Checking if ${{ env.server_major }} is EOL
30+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
31+
with:
32+
github-token: ${{secrets.GITHUB_TOKEN}}
33+
script: |
34+
const regex = /^stable(\d+)$/
35+
const baseRef = context.payload.pull_request.base.ref
36+
const match = baseRef.match(regex)
37+
if (match) {
38+
console.log('Setting server_major to ' + match[1]);
39+
core.exportVariable('server_major', match[1]);
40+
console.log('Setting current_month to ' + (new Date()).toISOString().substr(0, 7));
41+
core.exportVariable('current_month', (new Date()).toISOString().substr(0, 7));
42+
}
43+
44+
- name: Checking if server ${{ env.server_major }} is EOL
45+
if: ${{ env.server_major != '' }}
3746
run: |
3847
curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json \
3948
| jq '.["${{ env.server_major }}"]["eol"] // "9999-99" | . >= "${{ env.current_month }}"' \

.github/workflows/block-merge-freeze.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,30 @@ jobs:
2828
runs-on: ubuntu-latest-low
2929

3030
steps:
31-
- name: Download version.php from ${{ github.base_ref }}
32-
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ github.base_ref }}/version.php' --output version.php
31+
- name: Register server reference to fallback to master branch
32+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
33+
with:
34+
github-token: ${{secrets.GITHUB_TOKEN}}
35+
script: |
36+
const baseRef = context.payload.pull_request.base.ref
37+
if (baseRef === 'main' || baseRef === 'master') {
38+
core.exportVariable('server_ref', 'master');
39+
console.log('Setting server_ref to master');
40+
} else {
41+
const regex = /^stable(\d+)$/
42+
const match = baseRef.match(regex)
43+
if (match) {
44+
core.exportVariable('server_ref', match[0]);
45+
console.log('Setting server_ref to ' + match[0]);
46+
} else {
47+
console.log('Not based on master/main/stable*, so skipping freeze check');
48+
}
49+
}
50+
51+
- name: Download version.php from ${{ env.server_ref }}
52+
if: ${{ env.server_ref != '' }}
53+
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3354

3455
- name: Run check
56+
if: ${{ env.server_ref != '' }}
3557
run: cat version.php | grep 'OC_VersionString' | grep -i -v 'RC'

.github/workflows/block-outdated-3rdparty.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,49 @@ jobs:
3131
- 'version.php'
3232
3333
- name: Checkout
34-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
34+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
persist-credentials: false
3537

3638
- name: 3rdparty commit hash on current branch
3739
id: actual
3840
run: |
3941
echo "commit=$(git submodule status | grep ' 3rdparty' | egrep -o '[a-f0-9]{40}')" >> "$GITHUB_OUTPUT"
4042
43+
- name: Register server reference to fallback to master branch
44+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
45+
with:
46+
github-token: ${{secrets.GITHUB_TOKEN}}
47+
script: |
48+
const baseRef = context.payload.pull_request.base.ref
49+
if (baseRef === 'main' || baseRef === 'master') {
50+
core.exportVariable('server_ref', 'master');
51+
console.log('Setting server_ref to master');
52+
} else {
53+
const regex = /^stable(\d+)$/
54+
const match = baseRef.match(regex)
55+
if (match) {
56+
core.exportVariable('server_ref', match[0]);
57+
console.log('Setting server_ref to ' + match[0]);
58+
} else {
59+
console.log('Not based on master/main/stable*, so skipping outdated 3rdparty check');
60+
}
61+
}
62+
4163
- name: Last 3rdparty commit on target branch
64+
if: ${{ env.server_ref != '' }}
4265
id: target
4366
run: |
44-
echo "commit=$(git ls-remote https://github.com/nextcloud/3rdparty refs/heads/${{ github.base_ref }} | awk '{ print $1}')" >> "$GITHUB_OUTPUT"
67+
echo "commit=$(git ls-remote https://github.com/nextcloud/3rdparty refs/heads/${{ env.server_ref }} | awk '{ print $1}')" >> "$GITHUB_OUTPUT"
4568
4669
- name: Compare if 3rdparty commits are different
70+
if: ${{ env.server_ref != '' }}
4771
run: |
4872
echo '3rdparty/ seems to not point to the last commit of the dedicated branch:'
4973
echo 'Branch has: ${{ steps.actual.outputs.commit }}'
50-
echo '${{ github.base_ref }} has: ${{ steps.target.outputs.commit }}'
74+
echo '${{ env.server_ref }} has: ${{ steps.target.outputs.commit }}'
5175
5276
- name: Fail if 3rdparty commits are different
53-
if: ${{ steps.changes.outputs.src != 'false' && steps.actual.outputs.commit != steps.target.outputs.commit }}
77+
if: ${{ env.server_ref != '' && steps.changes.outputs.src != 'false' && steps.actual.outputs.commit != steps.target.outputs.commit }}
5478
run: |
5579
exit 1

.github/workflows/block-unconventional-commits.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: false
3133

3234
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
3335
with:

.github/workflows/command-compile.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
issue_comment:
1212
types: [created]
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
init:
1619
runs-on: ubuntu-latest
@@ -76,7 +79,7 @@ jobs:
7679
fi
7780
7881
- name: Init branch
79-
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
82+
uses: xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1 # v3.0.0
8083
id: comment-branch
8184

8285
- name: Add reaction on failure
@@ -86,22 +89,24 @@ jobs:
8689
token: ${{ secrets.COMMAND_BOT_PAT }}
8790
repository: ${{ github.event.repository.full_name }}
8891
comment-id: ${{ github.event.comment.id }}
89-
reactions: "-1"
92+
reactions: '-1'
9093

9194
process:
9295
runs-on: ubuntu-latest
9396
needs: init
9497

9598
steps:
9699
- name: Restore cached git repository
97-
uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
100+
uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
98101
with:
99102
path: .git
100103
key: git-repo
101104

102105
- name: Checkout ${{ needs.init.outputs.head_ref }}
103-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
106+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
104107
with:
108+
# Needed to allow force push later
109+
persist-credentials: true
105110
token: ${{ secrets.COMMAND_BOT_PAT }}
106111
fetch-depth: 0
107112
ref: ${{ needs.init.outputs.head_ref }}
@@ -119,7 +124,7 @@ jobs:
119124
fallbackNpm: '^10'
120125

121126
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
122-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v3
127+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
123128
with:
124129
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
125130
cache: npm
@@ -176,4 +181,4 @@ jobs:
176181
token: ${{ secrets.COMMAND_BOT_PAT }}
177182
repository: ${{ github.event.repository.full_name }}
178183
comment-id: ${{ github.event.comment.id }}
179-
reactions: "-1"
184+
reactions: '-1'

.github/workflows/command-pull-3rdparty.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,60 @@ jobs:
3434
exit 1
3535
3636
- name: Init branch
37-
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
37+
uses: xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1 # v1
3838
id: comment-branch
3939

4040
- name: Checkout ${{ steps.comment-branch.outputs.head_ref }}
41-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
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 pull 3rdparty command');
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

.github/workflows/cypress.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@ env:
1818
# Adjust APP_NAME if your repository name is different
1919
APP_NAME: ${{ github.event.repository.name }}
2020

21-
# Server requires head_ref instead of base_ref, as we want to test the PR branch
21+
# This represents the server branch to checkout.
22+
# Usually it's the base branch of the PR, but for pushes it's the branch itself.
23+
# e.g. 'main', 'stable27' or 'feature/my-feature'
24+
# n.b. server will use head_ref, as we want to test the PR branch.
2225
BRANCH: ${{ github.head_ref || github.ref_name }}
2326

27+
28+
permissions:
29+
contents: read
30+
2431
jobs:
2532
init:
2633
runs-on: ubuntu-latest
@@ -39,8 +46,9 @@ jobs:
3946
exit 1
4047
4148
- name: Checkout server
42-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
49+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4350
with:
51+
persist-credentials: false
4452
# We need to checkout submodules for 3rdparty
4553
submodules: true
4654

@@ -62,7 +70,7 @@ jobs:
6270
fallbackNpm: "^10"
6371

6472
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
65-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
73+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
6674
with:
6775
node-version: ${{ steps.versions.outputs.nodeVersion }}
6876

@@ -78,7 +86,7 @@ jobs:
7886
run: npm run cypress:version
7987

8088
- name: Save context
81-
uses: buildjet/cache/save@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
89+
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
8290
with:
8391
key: cypress-context-${{ github.run_id }}
8492
path: ./
@@ -92,7 +100,7 @@ jobs:
92100
matrix:
93101
# Run multiple copies of the current job in parallel
94102
# Please increase the number or runners as your tests suite grows (0 based index for e2e tests)
95-
containers: ["component", '0', '1', '2', '3', '4', '5', '6', '7']
103+
containers: ['component', '0', '1', '2', '3', '4', '5', '6', '7']
96104
# Hack as strategy.job-total includes the component and GitHub does not allow math expressions
97105
# Always align this number with the total of e2e runners (max. index + 1)
98106
total-containers: [8]
@@ -101,22 +109,22 @@ jobs:
101109

102110
steps:
103111
- name: Restore context
104-
uses: buildjet/cache/restore@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
112+
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
105113
with:
106114
fail-on-cache-miss: true
107115
key: cypress-context-${{ github.run_id }}
108116
path: ./
109117

110118
- name: Set up node ${{ needs.init.outputs.nodeVersion }}
111-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
119+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
112120
with:
113121
node-version: ${{ needs.init.outputs.nodeVersion }}
114122

115123
- name: Set up npm ${{ needs.init.outputs.npmVersion }}
116124
run: npm i -g 'npm@${{ needs.init.outputs.npmVersion }}'
117125

118126
- name: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} cypress tests
119-
uses: cypress-io/github-action@df7484c5ba85def7eef30db301afa688187bc378 # v6.7.2
127+
uses: cypress-io/github-action@f1f0912d392f0d06bdd01fb9ebe3b3299e5806fb # v6.7.7
120128
with:
121129
component: ${{ matrix.containers == 'component' }}
122130
group: ${{ matrix.use-cypress-cloud && matrix.containers == 'component' && 'Run component' || matrix.use-cypress-cloud && 'Run E2E' || '' }}
@@ -135,8 +143,8 @@ jobs:
135143
SPLIT: ${{ matrix.total-containers }}
136144
SPLIT_INDEX: ${{ matrix.containers == 'component' && 0 || matrix.containers }}
137145

138-
- name: Upload snapshots
139-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
146+
- name: Upload snapshots and videos
147+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
140148
if: always()
141149
with:
142150
name: snapshots_videos_${{ matrix.containers }}
@@ -149,7 +157,7 @@ jobs:
149157
run: docker logs nextcloud-cypress-tests_${{ env.APP_NAME }} > nextcloud.log
150158

151159
- name: Upload NC logs
152-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
160+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
153161
if: failure() && matrix.containers != 'component'
154162
with:
155163
name: nc_logs_${{ matrix.containers }}
@@ -160,7 +168,7 @@ jobs:
160168
run: docker exec nextcloud-cypress-tests_${{ env.APP_NAME }} tar -cvjf - data > data.tar
161169

162170
- name: Upload data dir archive
163-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
171+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
164172
if: failure() && matrix.containers != 'component'
165173
with:
166174
name: nc_data_${{ matrix.containers }}

.github/workflows/dependabot-approve-merge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
name: Dependabot
1010

1111
on:
12-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -24,7 +24,7 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2828
runs-on: ubuntu-latest-low
2929
permissions:
3030
# for hmarr/auto-approve-action to approve PRs

0 commit comments

Comments
 (0)