Skip to content

Commit a68addf

Browse files
committed
ci: Update actions
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 871ffec commit a68addf

File tree

4 files changed

+85
-21
lines changed

4 files changed

+85
-21
lines changed

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

Lines changed: 25 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: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Block merges during freezes
710

@@ -26,11 +29,29 @@ jobs:
2629

2730
steps:
2831
- name: Register server reference to fallback to master branch
29-
run: |
30-
server_ref="$(if [ "${{ github.base_ref }}" = "main" ]; then echo -n "master"; else echo -n "${{ github.base_ref }}"; fi)"
31-
echo "server_ref=$server_ref" >> $GITHUB_ENV
32+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
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+
3251
- 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
52+
if: ${{ env.server_ref != '' }}
53+
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3454

3555
- name: Run check
56+
if: ${{ env.server_ref != '' }}
3657
run: cat version.php | grep 'OC_VersionString' | grep -i -v 'RC'

.github/workflows/composer-auto.yml

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Compile Command
2+
23
on:
34
issue_comment:
45
types: [created]
56

7+
permissions:
8+
contents: read
9+
610
jobs:
711
init:
812
runs-on: ubuntu-latest
@@ -14,42 +18,74 @@ jobs:
1418
head_ref: ${{ steps.comment-branch.outputs.head_ref }}
1519

1620
steps:
21+
- name: Get repository from pull request comment
22+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
23+
id: get-repository
24+
with:
25+
github-token: ${{secrets.GITHUB_TOKEN}}
26+
script: |
27+
const pull = await github.rest.pulls.get({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: context.issue.number
31+
});
32+
33+
const repositoryName = pull.data.head?.repo?.full_name
34+
console.log(repositoryName)
35+
return repositoryName
36+
37+
- name: Disabled on forks
38+
if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
39+
run: |
40+
echo 'Can not execute /composer-update on forks'
41+
exit 1
42+
1743
- name: Check actor permission
18-
uses: skjnldsv/check-actor-permission@v2
44+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
1945
with:
2046
require: write
2147

2248
- name: Add reaction on start
23-
uses: peter-evans/create-or-update-comment@v1
49+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
2450
with:
2551
token: ${{ secrets.COMMAND_BOT_PAT }}
2652
repository: ${{ github.event.repository.full_name }}
2753
comment-id: ${{ github.event.comment.id }}
28-
reaction-type: "+1"
54+
reactions: '+1'
2955

3056
- name: Init branch
31-
uses: xt0rted/pull-request-comment-branch@v1
57+
uses: xt0rted/pull-request-comment-branch@e8b8daa837e8ea7331c0003c9c316a64c6d8b0b1 # v3.0.0
3258
id: comment-branch
3359

60+
- name: Add reaction on failure
61+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
62+
if: failure()
63+
with:
64+
token: ${{ secrets.COMMAND_BOT_PAT }}
65+
repository: ${{ github.event.repository.full_name }}
66+
comment-id: ${{ github.event.comment.id }}
67+
reactions: '-1'
68+
3469
process:
3570
runs-on: ubuntu-latest
3671
needs: init
3772

3873
steps:
3974
- name: Checkout ${{ needs.init.outputs.head_ref }}
40-
uses: actions/checkout@v2
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4176
with:
77+
persist-credentials: false
4278
token: ${{ secrets.COMMAND_BOT_PAT }}
4379
fetch-depth: 0
4480
ref: ${{ needs.init.outputs.head_ref }}
4581

4682
- name: Setup git
4783
run: |
48-
git config --local user.email "nextcloud-command@users.noreply.github.com"
49-
git config --local user.name "nextcloud-command"
84+
git config --local user.email 'nextcloud-command@users.noreply.github.com'
85+
git config --local user.name 'nextcloud-command'
5086
5187
- name: Set up php
52-
uses: shivammathur/setup-php@master
88+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
5389
with:
5490
php-version: 8.1
5591
coverage: none
@@ -73,13 +109,13 @@ jobs:
73109
run: |
74110
git add .
75111
git commit --signoff -m 'chore(autoloader): Dump autoloader'
76-
git push --force origin ${{ needs.init.outputs.head_ref }}
112+
git push --force origin '${{ needs.init.outputs.head_ref }}'
77113
78114
- name: Add reaction on failure
79-
uses: peter-evans/create-or-update-comment@v1
115+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
80116
if: failure()
81117
with:
82118
token: ${{ secrets.COMMAND_BOT_PAT }}
83-
repository: ${{ github.event.repository.full_name }}
84-
comment-id: ${{ github.event.comment.id }}
85-
reaction-type: "-1"
119+
repository: '${{ github.event.repository.full_name }}'
120+
comment-id: '${{ github.event.comment.id }}'
121+
reactions: '-1'

.github/workflows/composer.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ on:
77
- master
88
- stable*
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
php:
1215
runs-on: ubuntu-latest
1316

1417
name: Check vendor changes
1518
steps:
1619
- name: Checkout
17-
uses: actions/checkout@master
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
persist-credentials: false
1823

1924
- name: Set up php
20-
uses: shivammathur/setup-php@master
25+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
2126
with:
2227
php-version: 8.1
2328
coverage: none

.github/workflows/lint-php.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ jobs:
2525

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

3032
- name: Set up php ${{ matrix.php-versions }}
31-
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
33+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 #v2.32.0
3234
with:
3335
php-version: ${{ matrix.php-versions }}
3436
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)