Skip to content

Commit 3e402de

Browse files
authored
Merge pull request #310 from nextcloud-libraries/chore/workflows
chore: update workflows from organization
2 parents a1f8b42 + 2f31d7b commit 3e402de

File tree

5 files changed

+64
-100
lines changed

5 files changed

+64
-100
lines changed
Lines changed: 19 additions & 10 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,11 +24,13 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[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:
3436
- name: Disabled on forks
@@ -37,13 +39,20 @@ jobs:
3739
echo 'Can not approve PRs from forks'
3840
exit 1
3941
42+
- uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0
43+
id: branchname
44+
with:
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
4047
# GitHub actions bot approve
41-
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
48+
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
49+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4250
with:
4351
github-token: ${{ secrets.GITHUB_TOKEN }}
4452

45-
# Nextcloud bot approve and merge request
46-
- 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/')
4757
with:
48-
target: minor
49-
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 15 additions & 20 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
@@ -13,36 +13,31 @@ on:
1313
release:
1414
types: [published]
1515

16+
permissions:
17+
contents: write
18+
1619
jobs:
1720
build-and-deploy:
1821
runs-on: ubuntu-latest
1922

2023
name: Build and deploy
2124
steps:
22-
- name: Check actor permission level
23-
# Only allow admin to deploy on release
24-
if: github.event.release
25-
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
26-
with:
27-
require: admin
28-
2925
- name: Checkout
30-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
with:
28+
persist-credentials: false
3129

32-
- name: Read package.json node and npm engines version
33-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
30+
- name: Read package.json
31+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
3432
id: versions
35-
with:
36-
fallbackNode: '^20'
37-
fallbackNpm: '^10'
3833

39-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
40-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
34+
- name: Set up node
35+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
4136
with:
42-
node-version: ${{ steps.versions.outputs.nodeVersion }}
37+
node-version: ${{ steps.versions.outputs.node-version }}
4338

44-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
45-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
39+
- name: Set up npm
40+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
4641

4742
- name: Install dependencies & build
4843
env:
@@ -55,7 +50,7 @@ jobs:
5550
- name: Deploy
5651
# Only deploy on release
5752
if: github.event.release
58-
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
53+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
5954
with:
6055
github_token: ${{ secrets.GITHUB_TOKEN }}
6156
publish_dir: ./dist/doc

.github/workflows/node.yml

Lines changed: 18 additions & 65 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
@@ -18,54 +18,33 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
changes:
22-
runs-on: ubuntu-latest
23-
24-
outputs:
25-
src: ${{ steps.changes.outputs.src}}
26-
27-
steps:
28-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
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-
- '**.js'
41-
- '**.ts'
42-
- '**.vue'
43-
4421
build:
4522
runs-on: ubuntu-latest
23+
name: node-build
4624

47-
needs: changes
48-
if: needs.changes.outputs.src != 'false'
49-
50-
name: NPM build
5125
steps:
5226
- name: Checkout
53-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
persist-credentials: false
5430

55-
- name: Read package.json node and npm engines version
56-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
31+
- name: Read package.json
32+
uses: nextcloud-libraries/parse-package-engines-action@122ae05d4257008180a514e1ddeb0c1b9d094bdd # v0.1.0
5733
id: versions
58-
with:
59-
fallbackNode: '^20'
60-
fallbackNpm: '^10'
6134

62-
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
63-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
35+
- name: Set up node
36+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
6437
with:
65-
node-version: ${{ steps.versions.outputs.nodeVersion }}
38+
node-version: ${{ steps.versions.outputs.node-version }}
6639

67-
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
68-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
40+
- name: Set up npm
41+
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'
42+
43+
- name: Validate package-lock.json # See https://github.com/npm/cli/issues/4460
44+
run: |
45+
npm i -g npm-package-lock-add-resolved@1.1.4
46+
npm-package-lock-add-resolved
47+
git --no-pager diff --exit-code
6948
7049
- name: Install dependencies & build
7150
env:
@@ -74,29 +53,3 @@ jobs:
7453
run: |
7554
npm ci
7655
npm run build --if-present
77-
78-
- name: Check webpack build changes
79-
run: |
80-
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
81-
82-
- name: Show changes on failure
83-
if: failure()
84-
run: |
85-
git status
86-
git --no-pager diff
87-
exit 1 # make it red to grab attention
88-
89-
summary:
90-
permissions:
91-
contents: none
92-
runs-on: ubuntu-latest
93-
needs: [changes, build]
94-
95-
if: always()
96-
97-
# This is the summary, we just avoid to rename it so that branch protection rules still match
98-
name: node
99-
100-
steps:
101-
- name: Summary status
102-
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi

.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)