Skip to content

Commit 1fddf43

Browse files
ci(actions): Update workflow templates from organization template repository
Signed-off-by: GitHub <noreply@github.com>
1 parent 09e08e9 commit 1fddf43

5 files changed

Lines changed: 62 additions & 48 deletions

File tree

‎.github/actions-lock.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dc0ae733f35c60274937c2647c027d46 lint-eslint.yml
1313
300be6a756abda800e40850918f2d964 lint-php.yml
1414
ab3a506506b1d7c1cea9593ecfd84366 lint-stylelint.yml
1515
03759c9dc0fa748cb927b9f9cadf2925 node.yml
16-
0dc931ec237a235370e224282608b20e npm-audit-fix.yml
16+
ffbfc28e30ea82e6334314aa8f703b67 npm-audit-fix.yml
1717
b45e44d9ffe39586b38b6a925c1a9740 openapi.yml
1818
3cacf28a710b387e83d3858af40b7ffe phpunit-mysql.yml
1919
f89c18551d6a29af9bca63a0fd30a039 phpunit-oci.yml
@@ -22,8 +22,8 @@ ba5a538fea1a9e53dfcbeb53b83ea6fa phpunit-sqlite.yml
2222
aaa395a26591445ccf4c8196d7f01ee7 pr-feedback.yml
2323
4f1080b33778a956a08efc7a41a11994 psalm.yml
2424
2dbec18233063b42f4d8e03bbb43671c reuse.yml
25-
a3440826636c0fd7c2d20b1de50363da update-nextcloud-ocp-approve-merge.yml
26-
1919e2ff468e875aeeae5fd088d4ce1f update-nextcloud-ocp.yml
25+
abcb8206c3f6c5a9dc86cccf57846bfc update-nextcloud-ocp-approve-merge.yml
26+
f951ce2c95c9fcf7f4122b6f4f44618d update-nextcloud-ocp.yml
2727
22604c31b526de270a080eb19967a638 update-stable-titles.yml
28-
b47a9fe981a7435caea92db33f5ad121 sync-workflow-templates.yml
28+
511439ba27869e0324f283142cc8b3df sync-workflow-templates.yml
2929
ab958fa2b07234fceab6b6d836fb7f19 npm-build.yml

‎.github/workflows/npm-audit-fix.yml‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ on:
1515
- cron: '30 2 * * 0'
1616

1717
permissions:
18-
contents: read
18+
contents: write
19+
pull-requests: write
1920

2021
jobs:
2122
build:
2223
runs-on: ubuntu-latest
2324

25+
env:
26+
# env variable for maintainers: 'false' disables auto-merge for these pull requests
27+
AUTOMERGE: true
28+
2429
strategy:
2530
fail-fast: false
2631
matrix:
@@ -29,7 +34,6 @@ jobs:
2934
- 'stable35'
3035
- 'stable34'
3136
- 'stable33'
32-
- 'stable32'
3337

3438
name: npm-audit-fix-${{ matrix.branches }}
3539

@@ -70,6 +74,7 @@ jobs:
7074
npm run build --if-present
7175
7276
- name: Create Pull Request
77+
id: create-pull-request
7378
if: steps.checkout.outcome == 'success'
7479
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
7580
with:
@@ -84,3 +89,19 @@ jobs:
8489
labels: |
8590
dependencies
8691
3. to review
92+
93+
# Approve using the default GITHUB_TOKEN, as the PR itself was created
94+
# using COMMAND_BOT_PAT and GitHub does not allow an account to approve its own PR
95+
- name: GitHub actions bot approve
96+
if: steps.create-pull-request.outputs.pull-request-operation != 'none'
97+
run: gh pr review --approve "$PR_URL"
98+
env:
99+
PR_URL: ${{ steps.create-pull-request.outputs.pull-request-url }}
100+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Enable auto merge
103+
if: steps.create-pull-request.outputs.pull-request-operation != 'none' && fromJSON(env.AUTOMERGE)
104+
uses: peter-evans/enable-pull-request-automerge@a660677d5469627102a1c1e11409dd063606628d # v3.0.0
105+
with:
106+
token: ${{ secrets.GITHUB_TOKEN }}
107+
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}

‎.github/workflows/sync-workflow-templates.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ jobs:
2929
- 'stable35'
3030
- 'stable34'
3131
- 'stable33'
32-
- 'stable32'
3332

3433
name: Update workflows in ${{ matrix.branches }}
3534

‎.github/workflows/update-nextcloud-ocp-approve-merge.yml‎

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,27 @@
66
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Auto approve nextcloud/ocp
9+
# TODO: Remove this after a grace period of 6 months to give everyone the chance to remove the workflow
10+
# TODO: To be removed mid 2027.
11+
name: No-op please remove this workflow
1012

11-
on:
12-
pull_request_target: # zizmor: ignore[dangerous-triggers]
13-
branches:
14-
- main
15-
- master
16-
- stable*
13+
on: pull_request
1714

1815
permissions:
19-
contents: read
16+
contents: none
2017

2118
concurrency:
2219
group: update-nextcloud-ocp-approve-merge-${{ github.head_ref || github.run_id }}
2320
cancel-in-progress: true
2421

2522
jobs:
2623
auto-approve-merge:
27-
if: github.actor == 'nextcloud-command'
2824
runs-on: ubuntu-latest-low
29-
permissions:
30-
# for auto-approve-action to approve PRs
31-
pull-requests: write
32-
# for alexwilson/enable-github-automerge-action to approve PRs
33-
contents: write
25+
if: always()
3426

35-
steps:
36-
- name: Disabled on forks
37-
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
38-
run: |
39-
echo 'Can not approve PRs from forks'
40-
exit 1
41-
42-
- uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0
43-
id: branchname
44-
with:
45-
repo-token: ${{ secrets.GITHUB_TOKEN }}
27+
# This is the summary, we just avoid to rename it so that branch protection rules still match
28+
name: auto-approve-merge
4629

47-
- name: GitHub actions bot approve
48-
if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp')
49-
run: gh pr review --approve "$PR_URL"
50-
env:
51-
PR_URL: ${{ github.event.pull_request.html_url }}
52-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
54-
# Enable GitHub auto merge
55-
- name: Auto merge
56-
uses: alexwilson/enable-github-automerge-action@2c32e18a76e0726ffe7a573bfff2d42a20885126 # 3.0.0
57-
if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp')
58-
with:
59-
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
steps:
31+
- name: No-op please remove this workflow
32+
run: echo "Approve and auto-merge has been folded into update-nextcloud-ocp.yml / update-nextcloud-ocp-matrix.yml, please remove this file"; exit 1;

‎.github/workflows/update-nextcloud-ocp.yml‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ on:
1414
- cron: "5 2 * * *"
1515

1616
permissions:
17-
contents: read
17+
contents: write
1818
issues: write
19+
pull-requests: write
1920

2021
jobs:
2122
update-nextcloud-ocp:
@@ -24,6 +25,10 @@ jobs:
2425
# Only allowed to be run on nextcloud repositories
2526
if: ${{ github.repository_owner == 'nextcloud' }}
2627

28+
env:
29+
# env variable for maintainers: 'false' disables auto-merge for these pull requests
30+
AUTOMERGE: true
31+
2732
strategy:
2833
fail-fast: false
2934
matrix:
@@ -32,7 +37,6 @@ jobs:
3237
- 'stable35'
3338
- 'stable34'
3439
- 'stable33'
35-
- 'stable32'
3640

3741
name: update-nextcloud-ocp-${{ matrix.branches }}
3842

@@ -101,6 +105,7 @@ jobs:
101105
body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}'
102106

103107
- name: Create Pull Request
108+
id: create-pull-request
104109
if: steps.checkout.outcome == 'success'
105110
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
106111
with:
@@ -111,7 +116,7 @@ jobs:
111116
signoff: true
112117
branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp'
113118
title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency'
114-
add-path: |
119+
add-paths: |
115120
composer.json
116121
composer.lock
117122
vendor-bin/nextcloud-ocp/composer.json
@@ -121,3 +126,19 @@ jobs:
121126
labels: |
122127
dependencies
123128
3. to review
129+
130+
# Approve using the default GITHUB_TOKEN, as the PR itself was created
131+
# using COMMAND_BOT_PAT and GitHub does not allow an account to approve its own PR
132+
- name: GitHub actions bot approve
133+
if: steps.create-pull-request.outputs.pull-request-operation != 'none'
134+
run: gh pr review --approve "$PR_URL"
135+
env:
136+
PR_URL: ${{ steps.create-pull-request.outputs.pull-request-url }}
137+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
139+
- name: Enable auto merge
140+
if: steps.create-pull-request.outputs.pull-request-operation != 'none' && fromJSON(env.AUTOMERGE)
141+
uses: peter-evans/enable-pull-request-automerge@a660677d5469627102a1c1e11409dd063606628d # v3.0.0
142+
with:
143+
token: ${{ secrets.GITHUB_TOKEN }}
144+
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}

0 commit comments

Comments
 (0)