Skip to content

Commit 4aca044

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

File tree

11 files changed

+137
-64
lines changed

11 files changed

+137
-64
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

6-
name: Pull request checks
6+
name: Block merges for EOL
77

88
on: pull_request
99

10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: block-merge-eol-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
1017
jobs:
1118
block-merges-eol:
1219
name: Block merges for EOL branches
@@ -24,7 +31,7 @@ jobs:
2431
# retrieve version number from branch reference
2532
server_major=$(echo "${{ github.base_ref }}" | sed -En 's/stable//p')
2633
echo "server_major=$server_major" >> $GITHUB_ENV
27-
34+
2835
- name: Checking if ${{ env.server_major }} is EOL
2936
run: |
30-
php -r 'echo json_encode(require_once "config.php");' | jq --arg version "${{ env.server_major }}" '.stable[$version]["100"].eol' | grep --silent -i 'false'
37+
php -r 'echo json_encode(require_once "config.php");' | jq --arg version "${{ env.server_major }}" '.stable[$version]["100"].eol // .beta[$version]["100"].eol' | grep --silent -i 'false'

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,24 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

6-
name: Pull request checks
6+
name: Block merges during freezes
77

8-
on: pull_request
8+
on:
9+
pull_request:
10+
types: [opened, ready_for_review, reopened, synchronize]
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: block-merge-freeze-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
918

1019
jobs:
1120
block-merges-during-freeze:
12-
name: Block merges during feature freezes
21+
name: Block merges during freezes
22+
23+
if: github.event.pull_request.draft == false
1324

1425
runs-on: ubuntu-latest
1526

.github/workflows/command-compile.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,43 @@ jobs:
1818

1919
steps:
2020
- name: Check actor permission
21-
uses: skjnldsv/check-actor-permission@v2
21+
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2
2222
with:
2323
require: write
2424

2525
- name: Add reaction on start
26-
uses: peter-evans/create-or-update-comment@v1
26+
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1
2727
with:
2828
token: ${{ secrets.COMMAND_BOT_PAT }}
2929
repository: ${{ github.event.repository.full_name }}
3030
comment-id: ${{ github.event.comment.id }}
31-
reaction-type: "+1"
31+
reactions: "+1"
3232

3333
- name: Parse command
34-
uses: skjnldsv/parse-command-comment@master
34+
uses: skjnldsv/parse-command-comment@7cef1df370a99dfd5bf896d50121390c96785db8 # v2
3535
id: command
3636

3737
# Init path depending on which command is run
3838
- name: Init path
3939
id: git-path
40-
run: |
40+
run: |
4141
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
42-
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg1}}"
42+
echo "path=${{ github.workspace }}${{steps.command.outputs.arg1}}" >> $GITHUB_OUTPUT
4343
else
44-
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg2}}"
44+
echo "path=${{ github.workspace }}${{steps.command.outputs.arg2}}" >> $GITHUB_OUTPUT
4545
fi
4646
4747
- name: Init branch
48-
uses: xt0rted/pull-request-comment-branch@v1
48+
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
4949
id: comment-branch
50-
50+
5151
process:
5252
runs-on: ubuntu-latest
5353
needs: init
5454

5555
steps:
5656
- name: Checkout ${{ needs.init.outputs.head_ref }}
57-
uses: actions/checkout@v3
57+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
5858
with:
5959
token: ${{ secrets.COMMAND_BOT_PAT }}
6060
fetch-depth: 0
@@ -66,14 +66,14 @@ jobs:
6666
git config --local user.name "nextcloud-command"
6767
6868
- name: Read package.json node and npm engines version
69-
uses: skjnldsv/read-package-engines-version-actions@v1
69+
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
7070
id: package-engines-versions
7171
with:
72-
fallbackNode: '^12'
73-
fallbackNpm: '^6'
72+
fallbackNode: '^16'
73+
fallbackNpm: '^7'
7474

7575
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
76-
uses: actions/setup-node@v2
76+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
7777
with:
7878
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
7979
cache: npm
@@ -90,7 +90,7 @@ jobs:
9090
if: ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
9191
run: |
9292
git add ${{ needs.init.outputs.git_path }}
93-
git commit --signoff -m 'Compile assets'
93+
git commit --signoff -m 'chore(assets): Recompile assets'
9494
git push origin ${{ needs.init.outputs.head_ref }}
9595
9696
- name: Commit and push fixup
@@ -108,10 +108,10 @@ jobs:
108108
git push --force origin ${{ needs.init.outputs.head_ref }}
109109
110110
- name: Add reaction on failure
111-
uses: peter-evans/create-or-update-comment@v1
111+
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1
112112
if: failure()
113113
with:
114114
token: ${{ secrets.COMMAND_BOT_PAT }}
115115
repository: ${{ github.event.repository.full_name }}
116116
comment-id: ${{ github.event.comment.id }}
117-
reaction-type: "-1"
117+
reactions: "-1"

.github/workflows/command-rebase.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
issue_comment:
1010
types: created
1111

12-
permissions:
13-
contents: read
12+
permissions:
13+
contents: read
1414

1515
jobs:
1616
rebase:
@@ -23,26 +23,26 @@ jobs:
2323

2424
steps:
2525
- name: Add reaction on start
26-
uses: peter-evans/create-or-update-comment@v2
26+
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1
2727
with:
2828
token: ${{ secrets.COMMAND_BOT_PAT }}
2929
repository: ${{ github.event.repository.full_name }}
3030
comment-id: ${{ github.event.comment.id }}
3131
reaction-type: "+1"
3232

3333
- name: Checkout the latest code
34-
uses: actions/checkout@v3
34+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
3535
with:
3636
fetch-depth: 0
3737
token: ${{ secrets.COMMAND_BOT_PAT }}
3838

3939
- name: Automatic Rebase
40-
uses: cirrus-actions/rebase@1.7
40+
uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
4343

4444
- name: Add reaction on failure
45-
uses: peter-evans/create-or-update-comment@v2
45+
uses: peter-evans/create-or-update-comment@ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b # v3.0.1
4646
if: failure()
4747
with:
4848
token: ${{ secrets.COMMAND_BOT_PAT }}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,33 @@ name: Dependabot
88
on:
99
pull_request_target:
1010
branches:
11+
- main
1112
- master
1213
- stable*
1314

15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: dependabot-approve-merge-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
1422
jobs:
1523
auto-approve-merge:
1624
if: github.actor == 'dependabot[bot]'
1725
runs-on: ubuntu-latest
26+
permissions:
27+
# for hmarr/auto-approve-action to approve PRs
28+
pull-requests: write
1829

1930
steps:
2031
# Github actions bot approve
21-
- uses: hmarr/auto-approve-action@v2
32+
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
2233
with:
2334
github-token: ${{ secrets.GITHUB_TOKEN }}
2435

2536
# Nextcloud bot approve and merge request
26-
- uses: ahmadnassri/action-dependabot-auto-merge@v2
37+
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
2738
with:
2839
target: minor
2940
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}

.github/workflows/fixup.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

6-
name: Pull request checks
6+
name: Block fixup and squash commits
77

8-
on: pull_request
8+
on:
9+
pull_request:
10+
types: [opened, ready_for_review, reopened, synchronize]
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: fixup-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
918

1019
jobs:
1120
commit-message-check:
21+
if: github.event.pull_request.draft == false
22+
23+
permissions:
24+
pull-requests: write
1225
name: Block fixup and squash commits
1326

1427
runs-on: ubuntu-latest
1528

1629
steps:
1730
- name: Run check
18-
uses: xt0rted/block-autosquash-commits-action@v2
31+
uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1
1932
with:
2033
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,31 @@
22
#
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5-
6-
name: Lint
7-
8-
on: pull_request
5+
#
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
8+
9+
name: Lint eslint
10+
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'
925

1026
permissions:
1127
contents: read
1228

13-
concurrency:
29+
concurrency:
1430
group: lint-eslint-${{ github.head_ref || github.run_id }}
1531
cancel-in-progress: true
1632

@@ -22,17 +38,17 @@ jobs:
2238

2339
steps:
2440
- name: Checkout
25-
uses: actions/checkout@v3
41+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
2642

2743
- name: Read package.json node and npm engines version
28-
uses: skjnldsv/read-package-engines-version-actions@v1.2
44+
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
2945
id: versions
3046
with:
31-
fallbackNode: '^12'
32-
fallbackNpm: '^6'
47+
fallbackNode: '^16'
48+
fallbackNpm: '^7'
3349

3450
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
35-
uses: actions/setup-node@v3
51+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
3652
with:
3753
node-version: ${{ steps.versions.outputs.nodeVersion }}
3854

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

6-
name: Lint
6+
name: Lint php-cs
77

88
on: pull_request
99

@@ -22,18 +22,19 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
2626

2727
- name: Set up php
28-
uses: shivammathur/setup-php@v2
28+
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
2929
with:
30-
php-version: "8.0"
30+
php-version: 8.1
3131
coverage: none
32+
ini-file: development
3233
env:
3334
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3435

3536
- name: Install dependencies
3637
run: composer i
3738

3839
- name: Lint
39-
run: composer run cs:check || ( echo "Please run `composer run cs:fix` to format your code" && exit 1 )
40+
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55

6-
name: Lint
6+
name: Lint php
77

88
on:
99
pull_request:
@@ -31,13 +31,14 @@ jobs:
3131

3232
steps:
3333
- name: Checkout
34-
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
34+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
3535

3636
- name: Set up php ${{ matrix.php-versions }}
37-
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
37+
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
3838
with:
3939
php-version: ${{ matrix.php-versions }}
4040
coverage: none
41+
ini-file: development
4142
env:
4243
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4344

0 commit comments

Comments
 (0)