Skip to content

Commit c76669b

Browse files
committed
chore: update workflows from templates
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 437fc02 commit c76669b

14 files changed

+395
-229
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
types: [published]
1111

1212
env:
13-
PHP_VERSION: 8.1
13+
PHP_VERSION: 8.2
1414

1515
jobs:
1616
build_and_publish:
@@ -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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3636
with:
3737
path: ${{ env.APP_NAME }}
3838

@@ -44,19 +44,19 @@ 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@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
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@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
6060
with:
6161
node-version: ${{ steps.versions.outputs.nodeVersion }}
6262

@@ -66,7 +66,7 @@ jobs:
6666
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
6767

6868
- name: Set up php ${{ env.PHP_VERSION }}
69-
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
69+
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
7070
with:
7171
php-version: ${{ env.PHP_VERSION }}
7272
coverage: none
@@ -75,7 +75,7 @@ jobs:
7575

7676
- name: Check composer.json
7777
id: check_composer
78-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
78+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
7979
with:
8080
files: "${{ env.APP_NAME }}/composer.json"
8181

@@ -88,14 +88,16 @@ jobs:
8888
- name: Build ${{ env.APP_NAME }}
8989
# Skip if no package.json
9090
if: ${{ steps.versions.outputs.nodeVersion }}
91+
env:
92+
CYPRESS_INSTALL_BINARY: 0
9193
run: |
9294
cd ${{ env.APP_NAME }}
9395
npm ci
9496
npm run build
9597
9698
- name: Check Krankerl config
9799
id: krankerl
98-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
100+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99101
with:
100102
files: ${{ env.APP_NAME }}/krankerl.toml
101103

@@ -126,7 +128,7 @@ jobs:
126128
unzip latest-$NCVERSION.zip
127129
128130
- name: Checkout server master fallback
129-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
131+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
130132
if: ${{ steps.server-checkout.outcome != 'success' }}
131133
with:
132134
submodules: true
@@ -149,7 +151,7 @@ jobs:
149151
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150152
151153
- name: Attach tarball to github release
152-
uses: svenstaro/upload-release-action@2b9d2847a97b04d02ad5c3df2d3a27baa97ce689 # v2
154+
uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2
153155
id: attach_to_release
154156
with:
155157
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/command-compile.yml

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,34 @@ jobs:
1515
arg1: ${{ steps.command.outputs.arg1 }}
1616
arg2: ${{ steps.command.outputs.arg2 }}
1717
head_ref: ${{ steps.comment-branch.outputs.head_ref }}
18+
base_ref: ${{ steps.comment-branch.outputs.base_ref }}
1819

1920
steps:
2021
- name: Check actor permission
21-
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2
22+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2223
with:
2324
require: write
2425

2526
- name: Add reaction on start
26-
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
27+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
2728
with:
2829
token: ${{ secrets.COMMAND_BOT_PAT }}
2930
repository: ${{ github.event.repository.full_name }}
3031
comment-id: ${{ github.event.comment.id }}
3132
reactions: "+1"
3233

3334
- name: Parse command
34-
uses: skjnldsv/parse-command-comment@7cef1df370a99dfd5bf896d50121390c96785db8 # v2
35+
uses: skjnldsv/parse-command-comment@d8c0034c481b791dd6348fcacd9c510dc3a4cb4f # v2
3536
id: command
3637

3738
# Init path depending on which command is run
3839
- name: Init path
3940
id: git-path
4041
run: |
4142
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
42-
echo "path=${{ github.workspace }}${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
43+
echo "path=${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
4344
else
44-
echo "path=${{ github.workspace }}${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
45+
echo "path=${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
4546
fi
4647
4748
- name: Init branch
@@ -54,13 +55,13 @@ jobs:
5455

5556
steps:
5657
- name: Restore cached git repository
57-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
58+
uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
5859
with:
5960
path: .git
6061
key: git-repo
6162

6263
- name: Checkout ${{ needs.init.outputs.head_ref }}
63-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
64+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
6465
with:
6566
token: ${{ secrets.COMMAND_BOT_PAT }}
6667
fetch-depth: 0
@@ -76,45 +77,61 @@ jobs:
7677
id: package-engines-versions
7778
with:
7879
fallbackNode: '^20'
79-
fallbackNpm: '^9'
80+
fallbackNpm: '^10'
8081

8182
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
82-
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
83+
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
8384
with:
8485
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
8586
cache: npm
8687

8788
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
8889
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
90+
91+
- name: Rebase to ${{ needs.init.outputs.base_ref }}
92+
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93+
run: |
94+
git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95+
git rebase origin/${{ needs.init.outputs.base_ref }}
8996
9097
- name: Install dependencies & build
98+
env:
99+
CYPRESS_INSTALL_BINARY: 0
100+
PUPPETEER_SKIP_DOWNLOAD: true
91101
run: |
92102
npm ci
93103
npm run build --if-present
94104
95-
- name: Commit and push default
96-
if: ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
105+
- name: Commit default
106+
if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
97107
run: |
98-
git add ${{ needs.init.outputs.git_path }}
108+
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
99109
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' }}
110+
111+
- name: Commit fixup
112+
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
104113
run: |
105-
git add ${{ needs.init.outputs.git_path }}
114+
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
106115
git commit --fixup=HEAD --signoff
107-
git push origin ${{ needs.init.outputs.head_ref }}
108116
109-
- name: Commit and push amend
110-
if: ${{ needs.init.outputs.arg1 == 'amend' }}
117+
- name: Commit amend
118+
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
111119
run: |
112-
git add ${{ needs.init.outputs.git_path }}
120+
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
113121
git commit --amend --no-edit --signoff
114-
git push --force origin ${{ needs.init.outputs.head_ref }}
122+
# Remove any [skip ci] from the amended commit
123+
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124+
125+
- name: Push normally
126+
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127+
run: git push origin ${{ needs.init.outputs.head_ref }}
128+
129+
- name: Force push
130+
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131+
run: git push --force origin ${{ needs.init.outputs.head_ref }}
115132

116133
- name: Add reaction on failure
117-
uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
134+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
118135
if: failure()
119136
with:
120137
token: ${{ secrets.COMMAND_BOT_PAT }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
jobs:
2323
auto-approve-merge:
2424
if: github.actor == 'dependabot[bot]'
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-latest-low
2626
permissions:
2727
# for hmarr/auto-approve-action to approve PRs
2828
pull-requests: write

.github/workflows/lint-eslint.yml

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,7 @@
88

99
name: Lint eslint
1010

11-
on:
12-
pull_request:
13-
paths:
14-
- '.github/workflows/**'
15-
- 'src/**'
16-
- 'appinfo/info.xml'
17-
- 'package.json'
18-
- 'package-lock.json'
19-
- 'tsconfig.json'
20-
- '.eslintrc.*'
21-
- '.eslintignore'
22-
- '**.js'
23-
- '**.ts'
24-
- '**.vue'
11+
on: pull_request
2512

2613
permissions:
2714
contents: read
@@ -31,32 +18,78 @@ concurrency:
3118
cancel-in-progress: true
3219

3320
jobs:
21+
changes:
22+
runs-on: ubuntu-latest-low
23+
24+
outputs:
25+
src: ${{ steps.changes.outputs.src}}
26+
27+
steps:
28+
- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
29+
id: changes
30+
continue-on-error: true
31+
with:
32+
filters: |
33+
src:
34+
- '.github/workflows/**'
35+
- 'src/**'
36+
- 'appinfo/info.xml'
37+
- 'package.json'
38+
- 'package-lock.json'
39+
- 'tsconfig.json'
40+
- '.eslintrc.*'
41+
- '.eslintignore'
42+
- '**.js'
43+
- '**.ts'
44+
- '**.vue'
45+
3446
lint:
3547
runs-on: ubuntu-latest
3648

37-
name: eslint
49+
needs: changes
50+
if: needs.changes.outputs.src != 'false'
51+
52+
name: NPM lint
3853

3954
steps:
4055
- name: Checkout
41-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
56+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4257

4358
- name: Read package.json node and npm engines version
4459
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
4560
id: versions
4661
with:
4762
fallbackNode: '^20'
48-
fallbackNpm: '^9'
63+
fallbackNpm: '^10'
4964

5065
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
51-
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
66+
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
5267
with:
5368
node-version: ${{ steps.versions.outputs.nodeVersion }}
5469

5570
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
5671
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
5772

5873
- name: Install dependencies
74+
env:
75+
CYPRESS_INSTALL_BINARY: 0
76+
PUPPETEER_SKIP_DOWNLOAD: true
5977
run: npm ci
6078

6179
- name: Lint
6280
run: npm run lint
81+
82+
summary:
83+
permissions:
84+
contents: none
85+
runs-on: ubuntu-latest-low
86+
needs: [changes, lint]
87+
88+
if: always()
89+
90+
# This is the summary, we just avoid to rename it so that branch protection rules still match
91+
name: eslint
92+
93+
steps:
94+
- name: Summary status
95+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.github/workflows/lint-info-xml.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
name: Lint info.xml
77

8-
on:
9-
pull_request:
10-
push:
11-
branches:
12-
- main
13-
- master
14-
- stable*
8+
on: pull_request
159

1610
permissions:
1711
contents: read
@@ -22,18 +16,18 @@ concurrency:
2216

2317
jobs:
2418
xml-linters:
25-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-latest-low
2620

2721
name: info.xml lint
2822
steps:
2923
- name: Checkout
30-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3125

3226
- name: Download schema
3327
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd
3428

3529
- name: Lint info.xml
36-
uses: ChristophWurst/xmllint-action@39155a91429af431d65fafc21fa52ba5c4f5cb71 # v1.1
30+
uses: ChristophWurst/xmllint-action@36f2a302f84f8c83fceea0b9c59e1eb4a616d3c1 # v1.2
3731
with:
3832
xml-file: ./appinfo/info.xml
3933
xml-schema-file: ./info.xsd

0 commit comments

Comments
 (0)