Skip to content

Commit c86882a

Browse files
authored
Merge pull request #1311 from nextcloud/chore/update-workflow/stable28
[stable28] chore: update .git/workflows content
2 parents f1524d0 + 46c144c commit c86882a

12 files changed

+217
-83
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# 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
58

69
name: Block merges during freezes
710

@@ -27,10 +30,10 @@ jobs:
2730
steps:
2831
- name: Register server reference to fallback to master branch
2932
run: |
30-
server_ref="$(if [ "${{ github.base_ref }}" = "main" ]; then echo -n "master"; else echo -n "${{ github.base_ref }}"; fi)"
33+
server_ref="$(if [ '${{ github.base_ref }}' = 'main' ]; then echo -n 'master'; else echo -n '${{ github.base_ref }}'; fi)"
3134
echo "server_ref=$server_ref" >> $GITHUB_ENV
3235
- name: Download version.php from ${{ env.server_ref }}
33-
run: curl https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php --output version.php
36+
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3437

3538
- name: Run check
3639
run: cat version.php | grep 'OC_VersionString' | grep -i -v 'RC'

.github/workflows/command-compile.yml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
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+
19
name: Compile Command
210
on:
311
issue_comment:
@@ -18,6 +26,28 @@ jobs:
1826
base_ref: ${{ steps.comment-branch.outputs.base_ref }}
1927

2028
steps:
29+
- name: Get repository from pull request comment
30+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
31+
id: get-repository
32+
with:
33+
github-token: ${{secrets.GITHUB_TOKEN}}
34+
script: |
35+
const pull = await github.rest.pulls.get({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
pull_number: context.issue.number
39+
});
40+
41+
const repositoryName = pull.data.head?.repo?.full_name
42+
console.log(repositoryName)
43+
return repositoryName
44+
45+
- name: Disabled on forks
46+
if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
47+
run: |
48+
echo 'Can not execute /compile on forks'
49+
exit 1
50+
2151
- name: Check actor permission
2252
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2353
with:
@@ -29,10 +59,10 @@ jobs:
2959
token: ${{ secrets.COMMAND_BOT_PAT }}
3060
repository: ${{ github.event.repository.full_name }}
3161
comment-id: ${{ github.event.comment.id }}
32-
reactions: "+1"
62+
reactions: '+1'
3363

3464
- name: Parse command
35-
uses: skjnldsv/parse-command-comment@d8c0034c481b791dd6348fcacd9c510dc3a4cb4f # v2
65+
uses: skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
3666
id: command
3767

3868
# Init path depending on which command is run
@@ -49,6 +79,15 @@ jobs:
4979
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
5080
id: comment-branch
5181

82+
- name: Add reaction on failure
83+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
84+
if: failure()
85+
with:
86+
token: ${{ secrets.COMMAND_BOT_PAT }}
87+
repository: ${{ github.event.repository.full_name }}
88+
comment-id: ${{ github.event.comment.id }}
89+
reactions: '-1'
90+
5291
process:
5392
runs-on: ubuntu-latest
5493
needs: init
@@ -61,38 +100,38 @@ jobs:
61100
key: git-repo
62101

63102
- name: Checkout ${{ needs.init.outputs.head_ref }}
64-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
103+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65104
with:
66105
token: ${{ secrets.COMMAND_BOT_PAT }}
67106
fetch-depth: 0
68107
ref: ${{ needs.init.outputs.head_ref }}
69108

70109
- name: Setup git
71110
run: |
72-
git config --local user.email "[email protected]"
73-
git config --local user.name "nextcloud-command"
111+
git config --local user.email '[email protected]'
112+
git config --local user.name 'nextcloud-command'
74113
75114
- name: Read package.json node and npm engines version
76-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
115+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
77116
id: package-engines-versions
78117
with:
79118
fallbackNode: '^20'
80119
fallbackNpm: '^10'
81120

82121
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
83-
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
122+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
84123
with:
85124
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
86125
cache: npm
87126

88127
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
89-
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
128+
run: npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
90129

91130
- name: Rebase to ${{ needs.init.outputs.base_ref }}
92131
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93132
run: |
94-
git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95-
git rebase origin/${{ needs.init.outputs.base_ref }}
133+
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
134+
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
96135
97136
- name: Install dependencies & build
98137
env:
@@ -105,30 +144,30 @@ jobs:
105144
- name: Commit default
106145
if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
107146
run: |
108-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
147+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
109148
git commit --signoff -m 'chore(assets): Recompile assets'
110149
111150
- name: Commit fixup
112151
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113152
run: |
114-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
153+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
115154
git commit --fixup=HEAD --signoff
116155
117156
- name: Commit amend
118157
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
119158
run: |
120-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
159+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
121160
git commit --amend --no-edit --signoff
122161
# Remove any [skip ci] from the amended commit
123162
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124-
163+
125164
- name: Push normally
126165
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127-
run: git push origin ${{ needs.init.outputs.head_ref }}
166+
run: git push origin '${{ needs.init.outputs.head_ref }}'
128167

129168
- name: Force push
130169
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131-
run: git push --force origin ${{ needs.init.outputs.head_ref }}
170+
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
132171

133172
- name: Add reaction on failure
134173
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
@@ -137,4 +176,4 @@ jobs:
137176
token: ${{ secrets.COMMAND_BOT_PAT }}
138177
repository: ${{ github.event.repository.full_name }}
139178
comment-id: ${{ github.event.comment.id }}
140-
reactions: "-1"
179+
reactions: '-1'

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# 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
58

69
name: Dependabot
710

@@ -21,14 +24,20 @@ concurrency:
2124

2225
jobs:
2326
auto-approve-merge:
24-
if: github.actor == 'dependabot[bot]'
27+
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
2528
runs-on: ubuntu-latest-low
2629
permissions:
2730
# for hmarr/auto-approve-action to approve PRs
2831
pull-requests: write
2932

3033
steps:
31-
# Github actions bot approve
34+
- name: Disabled on forks
35+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
36+
run: |
37+
echo 'Can not approve PRs from forks'
38+
exit 1
39+
40+
# GitHub actions bot approve
3241
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
3342
with:
3443
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
6-
# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
7-
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
88

99
name: Lint eslint
1010

@@ -20,12 +20,15 @@ concurrency:
2020
jobs:
2121
changes:
2222
runs-on: ubuntu-latest-low
23+
permissions:
24+
contents: read
25+
pull-requests: read
2326

2427
outputs:
2528
src: ${{ steps.changes.outputs.src}}
2629

2730
steps:
28-
- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
2932
id: changes
3033
continue-on-error: true
3134
with:
@@ -53,22 +56,22 @@ jobs:
5356

5457
steps:
5558
- name: Checkout
56-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
59+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5760

5861
- name: Read package.json node and npm engines version
59-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
62+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
6063
id: versions
6164
with:
6265
fallbackNode: '^20'
6366
fallbackNpm: '^10'
6467

6568
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
66-
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
69+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6770
with:
6871
node-version: ${{ steps.versions.outputs.nodeVersion }}
6972

7073
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
71-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
74+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
7275

7376
- name: Install dependencies
7477
env:

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# 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
58

69
name: Lint php-cs
710

@@ -22,12 +25,16 @@ jobs:
2225

2326
steps:
2427
- name: Checkout
25-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
29+
30+
- name: Get php version
31+
id: versions
32+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
2633

27-
- name: Set up php8.2
28-
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
34+
- name: Set up php${{ steps.versions.outputs.php-available }}
35+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
2936
with:
30-
php-version: 8.2
37+
php-version: ${{ steps.versions.outputs.php-available }}
3138
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3239
coverage: none
3340
ini-file: development

.github/workflows/lint-php.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#
33
# https://github.com/nextcloud/.github
44
# 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
58

69
name: Lint php
710

@@ -15,20 +18,32 @@ concurrency:
1518
cancel-in-progress: true
1619

1720
jobs:
21+
matrix:
22+
runs-on: ubuntu-latest-low
23+
outputs:
24+
php-versions: ${{ steps.versions.outputs.php-versions }}
25+
steps:
26+
- name: Checkout app
27+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
- name: Get version matrix
29+
id: versions
30+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
31+
1832
php-lint:
1933
runs-on: ubuntu-latest
34+
needs: matrix
2035
strategy:
2136
matrix:
22-
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
37+
php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
2338

2439
name: php-lint
2540

2641
steps:
2742
- name: Checkout
28-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
43+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2944

3045
- name: Set up php ${{ matrix.php-versions }}
31-
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
46+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
3247
with:
3348
php-version: ${{ matrix.php-versions }}
3449
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

0 commit comments

Comments
 (0)