Skip to content

Commit 523bea0

Browse files
committed
chore: update workflows from templates
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent a0a9d4c commit 523bea0

15 files changed

+586
-296
lines changed

.github/workflows/appstore-build-publish.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
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: Build and publish app release
710

811
on:
912
release:
1013
types: [published]
1114

12-
env:
13-
PHP_VERSION: 8.1
14-
1515
jobs:
1616
build_and_publish:
1717
runs-on: ubuntu-latest
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Check actor permission
24-
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
24+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
2525
with:
2626
require: write
2727

@@ -32,7 +32,7 @@ jobs:
3232
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3333
3434
- name: Checkout
35-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
35+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3636
with:
3737
path: ${{ env.APP_NAME }}
3838

@@ -44,38 +44,44 @@ jobs:
4444
expression: "//info//dependencies//nextcloud/@min-version"
4545

4646
- name: Read package.json node and npm engines version
47-
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
47+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4848
id: versions
4949
# Continue if no package.json
5050
continue-on-error: true
5151
with:
5252
path: ${{ env.APP_NAME }}
53-
fallbackNode: "^16"
54-
fallbackNpm: "^7"
53+
fallbackNode: '^20'
54+
fallbackNpm: '^10'
5555

5656
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
5757
# Skip if no package.json
5858
if: ${{ steps.versions.outputs.nodeVersion }}
59-
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
59+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6060
with:
6161
node-version: ${{ steps.versions.outputs.nodeVersion }}
6262

6363
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
6464
# Skip if no package.json
6565
if: ${{ steps.versions.outputs.npmVersion }}
66-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
66+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
67+
68+
- name: Get php version
69+
id: php-versions
70+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
71+
with:
72+
filename: ${{ env.APP_NAME }}/appinfo/info.xml
6773

68-
- name: Set up php ${{ env.PHP_VERSION }}
69-
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
74+
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
75+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
7076
with:
71-
php-version: ${{ env.PHP_VERSION }}
77+
php-version: ${{ steps.php-versions.outputs.php-min }}
7278
coverage: none
7379
env:
7480
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7581

7682
- name: Check composer.json
7783
id: check_composer
78-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
84+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
7985
with:
8086
files: "${{ env.APP_NAME }}/composer.json"
8187

@@ -88,14 +94,16 @@ jobs:
8894
- name: Build ${{ env.APP_NAME }}
8995
# Skip if no package.json
9096
if: ${{ steps.versions.outputs.nodeVersion }}
97+
env:
98+
CYPRESS_INSTALL_BINARY: 0
9199
run: |
92100
cd ${{ env.APP_NAME }}
93101
npm ci
94-
npm run build
102+
npm run build --if-present
95103
96104
- name: Check Krankerl config
97105
id: krankerl
98-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
106+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
99107
with:
100108
files: ${{ env.APP_NAME }}/krankerl.toml
101109

@@ -121,12 +129,12 @@ jobs:
121129
continue-on-error: true
122130
id: server-checkout
123131
run: |
124-
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
132+
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
125133
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
126134
unzip latest-$NCVERSION.zip
127135
128136
- name: Checkout server master fallback
129-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
137+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
130138
if: ${{ steps.server-checkout.outcome != 'success' }}
131139
with:
132140
submodules: true
@@ -140,7 +148,7 @@ jobs:
140148
tar -xvf ${{ env.APP_NAME }}.tar.gz
141149
cd ../../../
142150
# Setting up keys
143-
echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
151+
echo '${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
144152
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145153
# Signing
146154
php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
@@ -149,7 +157,7 @@ jobs:
149157
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150158
151159
- name: Attach tarball to github release
152-
uses: svenstaro/upload-release-action@2b9d2847a97b04d02ad5c3df2d3a27baa97ce689 # v2
160+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
153161
id: attach_to_release
154162
with:
155163
repo_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 85 additions & 29 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:
@@ -15,109 +23,157 @@ jobs:
1523
arg1: ${{ steps.command.outputs.arg1 }}
1624
arg2: ${{ steps.command.outputs.arg2 }}
1725
head_ref: ${{ steps.comment-branch.outputs.head_ref }}
26+
base_ref: ${{ steps.comment-branch.outputs.base_ref }}
1827

1928
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+
2051
- name: Check actor permission
21-
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2
52+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2253
with:
2354
require: write
2455

2556
- name: Add reaction on start
26-
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
57+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
2758
with:
2859
token: ${{ secrets.COMMAND_BOT_PAT }}
2960
repository: ${{ github.event.repository.full_name }}
3061
comment-id: ${{ github.event.comment.id }}
31-
reactions: "+1"
62+
reactions: '+1'
3263

3364
- name: Parse command
34-
uses: skjnldsv/parse-command-comment@7cef1df370a99dfd5bf896d50121390c96785db8 # v2
65+
uses: skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
3566
id: command
3667

3768
# Init path depending on which command is run
3869
- name: Init path
3970
id: git-path
4071
run: |
4172
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
42-
echo "path=${{ github.workspace }}${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
73+
echo "path=${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
4374
else
44-
echo "path=${{ github.workspace }}${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
75+
echo "path=${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
4576
fi
4677
4778
- name: Init branch
4879
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
4980
id: comment-branch
5081

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+
5191
process:
5292
runs-on: ubuntu-latest
5393
needs: init
5494

5595
steps:
5696
- name: Restore cached git repository
57-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
97+
uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
5898
with:
5999
path: .git
60100
key: git-repo
61101

62102
- name: Checkout ${{ needs.init.outputs.head_ref }}
63-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
103+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
64104
with:
65105
token: ${{ secrets.COMMAND_BOT_PAT }}
66106
fetch-depth: 0
67107
ref: ${{ needs.init.outputs.head_ref }}
68108

69109
- name: Setup git
70110
run: |
71-
git config --local user.email "nextcloud-command@users.noreply.github.com"
72-
git config --local user.name "nextcloud-command"
111+
git config --local user.email 'nextcloud-command@users.noreply.github.com'
112+
git config --local user.name 'nextcloud-command'
73113
74114
- name: Read package.json node and npm engines version
75-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
115+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
76116
id: package-engines-versions
77117
with:
78118
fallbackNode: '^20'
79-
fallbackNpm: '^9'
119+
fallbackNpm: '^10'
80120

81121
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
82-
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
122+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
83123
with:
84124
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
85125
cache: npm
86126

87127
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
88-
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
128+
run: npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
129+
130+
- name: Rebase to ${{ needs.init.outputs.base_ref }}
131+
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
132+
run: |
133+
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
134+
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
89135
90136
- name: Install dependencies & build
137+
env:
138+
CYPRESS_INSTALL_BINARY: 0
139+
PUPPETEER_SKIP_DOWNLOAD: true
91140
run: |
92141
npm ci
93142
npm run build --if-present
94143
95-
- name: Commit and push default
96-
if: ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
144+
- name: Commit default
145+
if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
97146
run: |
98-
git add ${{ needs.init.outputs.git_path }}
147+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
99148
git commit --signoff -m 'chore(assets): Recompile assets'
100-
git push origin ${{ needs.init.outputs.head_ref }}
101-
102-
- name: Commit and push fixup
103-
if: ${{ needs.init.outputs.arg1 == 'fixup' }}
149+
150+
- name: Commit fixup
151+
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
104152
run: |
105-
git add ${{ needs.init.outputs.git_path }}
153+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
106154
git commit --fixup=HEAD --signoff
107-
git push origin ${{ needs.init.outputs.head_ref }}
108155
109-
- name: Commit and push amend
110-
if: ${{ needs.init.outputs.arg1 == 'amend' }}
156+
- name: Commit amend
157+
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
111158
run: |
112-
git add ${{ needs.init.outputs.git_path }}
159+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
113160
git commit --amend --no-edit --signoff
114-
git push --force origin ${{ needs.init.outputs.head_ref }}
161+
# Remove any [skip ci] from the amended commit
162+
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
163+
164+
- name: Push normally
165+
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
166+
run: git push origin '${{ needs.init.outputs.head_ref }}'
167+
168+
- name: Force push
169+
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
170+
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
115171

116172
- name: Add reaction on failure
117-
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
173+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
118174
if: failure()
119175
with:
120176
token: ${{ secrets.COMMAND_BOT_PAT }}
121177
repository: ${{ github.event.repository.full_name }}
122178
comment-id: ${{ github.event.comment.id }}
123-
reactions: "-1"
179+
reactions: '-1'

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

Lines changed: 12 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: Dependabot
710

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

2225
jobs:
2326
auto-approve-merge:
24-
if: github.actor == 'dependabot[bot]'
25-
runs-on: ubuntu-latest
27+
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
28+
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 }}

0 commit comments

Comments
 (0)