Skip to content

Commit cb6a6d9

Browse files
authored
Merge pull request #1496 from nextcloud/chore/stable28/workflows
2 parents 7f860a7 + 1c13e63 commit cb6a6d9

16 files changed

+308
-35
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block merges for EOL
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: block-merge-eol-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
block-merges-eol:
22+
name: Block merges for EOL branches
23+
24+
# Only run on stableXX branches
25+
if: startsWith( github.base_ref, 'stable')
26+
runs-on: ubuntu-latest-low
27+
28+
steps:
29+
- name: Set server major version environment
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 != '' }}
46+
run: |
47+
curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json \
48+
| jq '.["${{ env.server_major }}"]["eol"] // "9999-99" | . >= "${{ env.current_month }}"' \
49+
| grep -q true

.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'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block unconventional commits
10+
11+
on:
12+
pull_request:
13+
types: [opened, ready_for_review, reopened, synchronize]
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: block-unconventional-commits-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
block-unconventional-commits:
24+
name: Block unconventional commits
25+
26+
runs-on: ubuntu-latest-low
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: false
33+
34+
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
35+
with:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/command-compile.yml

Lines changed: 9 additions & 4 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
@@ -94,14 +97,16 @@ jobs:
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 # v4.0.3
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/fixup.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block fixup and squash commits
10+
11+
on:
12+
pull_request:
13+
types: [opened, ready_for_review, reopened, synchronize]
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: fixup-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
commit-message-check:
24+
if: github.event.pull_request.draft == false
25+
26+
permissions:
27+
pull-requests: write
28+
name: Block fixup and squash commits
29+
30+
runs-on: ubuntu-latest-low
31+
32+
steps:
33+
- name: Run check
34+
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
35+
with:
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656

5757
steps:
5858
- name: Checkout
59-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
59+
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@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,28 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
2931

3032
- name: Get php version
3133
id: versions
3234
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3335

34-
- name: Set up php${{ steps.versions.outputs.php-available }}
36+
- name: Set up php${{ steps.versions.outputs.php-min }}
3537
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
3638
with:
37-
php-version: ${{ steps.versions.outputs.php-available }}
39+
php-version: ${{ steps.versions.outputs.php-min }}
3840
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3941
coverage: none
4042
ini-file: development
4143
env:
4244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4345

4446
- name: Install dependencies
45-
run: composer i
47+
run: |
48+
composer remove nextcloud/ocp --dev
49+
composer i
4650
4751
- name: Lint
4852
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
php-versions: ${{ steps.versions.outputs.php-versions }}
2525
steps:
2626
- name: Checkout app
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
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
@@ -40,7 +43,9 @@ jobs:
4043

4144
steps:
4245
- name: Checkout
43-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
46+
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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ jobs:
6060

6161
steps:
6262
- name: Checkout
63-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
63+
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@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
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@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
96+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
9597
with:
9698
files: ./coverage/lcov.info
9799

0 commit comments

Comments
 (0)