Skip to content

Commit 0c198e9

Browse files
authored
Merge pull request #694 from nextcloud-libraries/chore/workflows
ci: update workflows from organization
2 parents 2c1e902 + a764666 commit 0c198e9

File tree

7 files changed

+104
-44
lines changed

7 files changed

+104
-44
lines changed

.github/workflows/block-unconventional-commits.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
@@ -27,7 +27,9 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
30+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
with:
32+
persist-credentials: false
3133

3234
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
3335
with:
Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
6-
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
6+
# SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Dependabot
9+
name: Auto approve Dependabot PRs
1010

1111
on:
12-
pull_request_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -24,20 +24,35 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2828
runs-on: ubuntu-latest
2929
permissions:
3030
# for hmarr/auto-approve-action to approve PRs
3131
pull-requests: write
32+
# for alexwilson/enable-github-automerge-action to approve PRs
33+
contents: write
3234

3335
steps:
34-
# Github actions bot approve
35-
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
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 }}
46+
47+
# GitHub actions bot approve
48+
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
49+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
3650
with:
3751
github-token: ${{ secrets.GITHUB_TOKEN }}
3852

39-
# Nextcloud bot approve and merge request
40-
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
53+
# Enable GitHub auto merge
54+
- name: Auto merge
55+
uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # v2.0.0
56+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4157
with:
42-
target: minor
43-
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
58+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/fixup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
@@ -31,6 +31,6 @@ jobs:
3131

3232
steps:
3333
- name: Run check
34-
uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1
34+
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
3535
with:
3636
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/node-test.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
@@ -12,23 +12,56 @@ on:
1212
pull_request:
1313
push:
1414
branches:
15+
- main
1516
- master
1617
- stable*
1718

19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: node-tests-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
1826
jobs:
1927
test:
2028
runs-on: ubuntu-latest
29+
name: node-tests
2130

22-
name: test
2331
steps:
2432
- name: Checkout
25-
uses: actions/checkout@v3
33+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
with:
35+
persist-credentials: false
36+
37+
- name: Read package.json
38+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
39+
id: versions
2640

2741
- name: Set up node
28-
uses: actions/setup-node@v3
42+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
43+
with:
44+
node-version: ${{ steps.versions.outputs.node-version }}
2945

30-
- name: Install dependencies
31-
run: npm ci
46+
- name: Set up npm
47+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
48+
49+
- name: Install dependencies & build
50+
env:
51+
CYPRESS_INSTALL_BINARY: 0
52+
run: |
53+
npm ci
54+
npm run build --if-present
3255
3356
- name: Test
34-
run: npm test
57+
run: npm run test --if-present
58+
59+
- name: Test and process coverage
60+
run: npm run test:coverage --if-present
61+
62+
- name: Collect coverage
63+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
64+
with:
65+
files: ./coverage/lcov.info
66+
env:
67+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

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

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is provided via the organization template repository
22
#
3-
# https://github.com/nextcloud/.github
3+
# https://github.com/nextcloud-libraries/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
66
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
@@ -14,53 +14,56 @@ on:
1414
# At 2:30 on Sundays
1515
- cron: '30 2 * * 0'
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
build:
1922
runs-on: ubuntu-latest
2023

2124
strategy:
2225
fail-fast: false
2326
matrix:
24-
branches: ['main', 'master', 'stable30', 'stable29', 'stable28']
27+
branches: ['main']
2528

2629
name: npm-audit-fix-${{ matrix.branches }}
2730

2831
steps:
2932
- name: Checkout
30-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
33+
id: checkout
34+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3135
with:
36+
persist-credentials: false
3237
ref: ${{ matrix.branches }}
38+
continue-on-error: true
3339

34-
- name: Read package.json node and npm engines version
35-
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
40+
- name: Read package.json
41+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
3642
id: versions
37-
with:
38-
fallbackNode: '^20'
39-
fallbackNpm: '^10'
4043

41-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
42-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
44+
- name: Set up node
45+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
4346
with:
44-
node-version: ${{ steps.versions.outputs.nodeVersion }}
47+
node-version: ${{ steps.versions.outputs.node-version }}
4548

46-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
47-
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
49+
- name: Set up npm
50+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
4851

4952
- name: Fix npm audit
5053
id: npm-audit
51-
uses: nextcloud-libraries/npm-audit-action@2a60bd2e79cc77f2cc4d9a3fe40f1a69896f3a87 # v0.1.0
54+
uses: nextcloud-libraries/npm-audit-action@1b1728b2b4a7a78d69de65608efcf4db0e3e42d0 # v0.2.0
5255

5356
- name: Run npm ci and npm run build
54-
if: always()
57+
if: steps.checkout.outcome == 'success'
5558
env:
5659
CYPRESS_INSTALL_BINARY: 0
5760
run: |
5861
npm ci
5962
npm run build --if-present
6063
6164
- name: Create Pull Request
62-
if: always()
63-
uses: peter-evans/create-pull-request@6cd32fd93684475c31847837f87bb135d40a2b79 # v7.0.3
65+
if: steps.checkout.outcome == 'success'
66+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
6467
with:
6568
token: ${{ secrets.COMMAND_BOT_PAT }}
6669
commit-message: 'fix(deps): Fix npm audit'

.github/workflows/npm-publish.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,21 @@ jobs:
2323

2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2727
with:
2828
persist-credentials: false
2929

30+
- name: Read package.json
31+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
32+
id: versions
33+
3034
- name: Set up node
31-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
35+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
3236
with:
33-
node-version-file: 'package.json'
37+
node-version: ${{ steps.versions.outputs.node-version }}
38+
39+
- name: Set up npm
40+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
3441

3542
- name: Check tag matches package.json
3643
run: |

.github/workflows/reuse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2323
with:
2424
persist-credentials: false
2525

2626
- name: REUSE Compliance Check
27-
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # v5.0.0
27+
uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0

0 commit comments

Comments
 (0)