Skip to content

Commit 227065f

Browse files
authored
Merge pull request #1493 from nextcloud/chore/workflows
2 parents 3a340c7 + 96f91e8 commit 227065f

16 files changed

+103
-24
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@v7
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: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,29 @@ jobs:
2929

3030
steps:
3131
- name: Register server reference to fallback to master branch
32-
run: |
33-
server_ref="$(if [ '${{ github.base_ref }}' = 'main' ]; then echo -n 'master'; else echo -n '${{ github.base_ref }}'; fi)"
34-
echo "server_ref=$server_ref" >> $GITHUB_ENV
32+
uses: actions/github-script@v7
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+
3551
- name: Download version.php from ${{ env.server_ref }}
52+
if: ${{ env.server_ref != '' }}
3653
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3754

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
steps:
2929
- name: Checkout
3030
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: 7 additions & 2 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
@@ -94,14 +97,16 @@ jobs:
9497

9598
steps:
9699
- name: Restore cached git repository
97-
uses: buildjet/cache/save@v4
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 }}
103106
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@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
127+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
123128
with:
124129
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
125130
cache: npm

.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:
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

.github/workflows/lint-eslint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
steps:
5858
- name: Checkout
5959
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
with:
61+
persist-credentials: false
6062

6163
- name: Read package.json node and npm engines version
6264
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
@@ -66,7 +68,7 @@ jobs:
6668
fallbackNpm: '^10'
6769

6870
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
69-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
71+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
7072
with:
7173
node-version: ${{ steps.versions.outputs.nodeVersion }}
7274

.github/workflows/lint-php-cs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
2931

3032
- name: Get php version
3133
id: versions

.github/workflows/lint-php.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
steps:
2626
- name: Checkout app
2727
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
30+
2831
- name: Get version matrix
2932
id: versions
3033
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
@@ -41,6 +44,8 @@ jobs:
4144
steps:
4245
- name: Checkout
4346
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
persist-credentials: false
4449

4550
- name: Set up php ${{ matrix.php-versions }}
4651
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1

.github/workflows/node-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
steps:
6262
- name: Checkout
6363
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
with:
65+
persist-credentials: false
6466

6567
- name: Read package.json node and npm engines version
6668
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
@@ -70,7 +72,7 @@ jobs:
7072
fallbackNpm: '^10'
7173

7274
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
73-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
75+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
7476
with:
7577
node-version: ${{ steps.versions.outputs.nodeVersion }}
7678

@@ -91,7 +93,7 @@ jobs:
9193
run: npm run test:coverage --if-present
9294

9395
- name: Collect coverage
94-
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
96+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
9597
with:
9698
files: ./coverage/lcov.info
9799

.github/workflows/node.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
steps:
5555
- name: Checkout
5656
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
with:
58+
persist-credentials: false
5759

5860
- name: Read package.json node and npm engines version
5961
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
@@ -63,7 +65,7 @@ jobs:
6365
fallbackNpm: '^10'
6466

6567
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
66-
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
68+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
6769
with:
6870
node-version: ${{ steps.versions.outputs.nodeVersion }}
6971

0 commit comments

Comments
 (0)