Skip to content

Commit 008fdfe

Browse files
committed
ci: Add missing node workflows
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 9970632 commit 008fdfe

6 files changed

+389
-2
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Dependabot
10+
11+
on:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
13+
branches:
14+
- main
15+
- master
16+
- stable*
17+
18+
permissions:
19+
contents: read
20+
21+
concurrency:
22+
group: dependabot-approve-merge-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
auto-approve-merge:
27+
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
28+
runs-on: ubuntu-latest-low
29+
permissions:
30+
# for hmarr/auto-approve-action to approve PRs
31+
pull-requests: write
32+
33+
steps:
34+
- name: Disabled on forks
35+
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
36+
run: |
37+
echo 'Can not approve PRs from forks'
38+
exit 1
39+
40+
# GitHub actions bot approve
41+
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
42+
with:
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
45+
# Nextcloud bot approve and merge request
46+
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
47+
with:
48+
target: minor
49+
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint eslint
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: lint-eslint-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
changes:
22+
runs-on: ubuntu-latest-low
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src}}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- 'src/**'
39+
- 'appinfo/info.xml'
40+
- 'package.json'
41+
- 'package-lock.json'
42+
- 'tsconfig.json'
43+
- '.eslintrc.*'
44+
- '.eslintignore'
45+
- '**.js'
46+
- '**.ts'
47+
- '**.vue'
48+
49+
lint:
50+
runs-on: ubuntu-latest
51+
52+
needs: changes
53+
if: needs.changes.outputs.src != 'false'
54+
55+
name: NPM lint
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
with:
61+
persist-credentials: false
62+
63+
- name: Read package.json node and npm engines version
64+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
65+
id: versions
66+
with:
67+
fallbackNode: '^20'
68+
fallbackNpm: '^10'
69+
70+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
71+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
72+
with:
73+
node-version: ${{ steps.versions.outputs.nodeVersion }}
74+
75+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
76+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
77+
78+
- name: Install dependencies
79+
env:
80+
CYPRESS_INSTALL_BINARY: 0
81+
PUPPETEER_SKIP_DOWNLOAD: true
82+
run: npm ci
83+
84+
- name: Lint
85+
run: npm run lint
86+
87+
summary:
88+
permissions:
89+
contents: none
90+
runs-on: ubuntu-latest-low
91+
needs: [changes, lint]
92+
93+
if: always()
94+
95+
# This is the summary, we just avoid to rename it so that branch protection rules still match
96+
name: eslint
97+
98+
steps:
99+
- name: Summary status
100+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.github/workflows/lint-stylelint.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Lint stylelint
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: lint-stylelint-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
lint:
22+
runs-on: ubuntu-latest
23+
24+
name: stylelint
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
31+
32+
- name: Read package.json node and npm engines version
33+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
34+
id: versions
35+
with:
36+
fallbackNode: '^20'
37+
fallbackNpm: '^10'
38+
39+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
40+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
41+
with:
42+
node-version: ${{ steps.versions.outputs.nodeVersion }}
43+
44+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
45+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
46+
47+
- name: Install dependencies
48+
env:
49+
CYPRESS_INSTALL_BINARY: 0
50+
run: npm ci
51+
52+
- name: Lint
53+
run: npm run stylelint

.github/workflows/node.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Node
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: node-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
changes:
22+
runs-on: ubuntu-latest-low
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src}}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- 'src/**'
39+
- 'appinfo/info.xml'
40+
- 'package.json'
41+
- 'package-lock.json'
42+
- 'tsconfig.json'
43+
- '**.js'
44+
- '**.ts'
45+
- '**.vue'
46+
47+
build:
48+
runs-on: ubuntu-latest
49+
50+
needs: changes
51+
if: needs.changes.outputs.src != 'false'
52+
53+
name: NPM build
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
with:
58+
persist-credentials: false
59+
60+
- name: Read package.json node and npm engines version
61+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
62+
id: versions
63+
with:
64+
fallbackNode: '^20'
65+
fallbackNpm: '^10'
66+
67+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
68+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
69+
with:
70+
node-version: ${{ steps.versions.outputs.nodeVersion }}
71+
72+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
73+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
74+
75+
- name: Install dependencies & build
76+
env:
77+
CYPRESS_INSTALL_BINARY: 0
78+
PUPPETEER_SKIP_DOWNLOAD: true
79+
run: |
80+
npm ci
81+
npm run build --if-present
82+
83+
- name: Check webpack build changes
84+
run: |
85+
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
86+
87+
- name: Show changes on failure
88+
if: failure()
89+
run: |
90+
git status
91+
git --no-pager diff
92+
exit 1 # make it red to grab attention
93+
94+
summary:
95+
permissions:
96+
contents: none
97+
runs-on: ubuntu-latest-low
98+
needs: [changes, build]
99+
100+
if: always()
101+
102+
# This is the summary, we just avoid to rename it so that branch protection rules still match
103+
name: node
104+
105+
steps:
106+
- name: Summary status
107+
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi

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

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Npm audit fix and compile
10+
11+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# At 2:30 on Sundays
15+
- cron: '30 2 * * 0'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
branches: ['main']
25+
26+
name: npm-audit-fix-${{ matrix.branches }}
27+
28+
steps:
29+
- name: Checkout
30+
id: checkout
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
with:
33+
persist-credentials: false
34+
ref: ${{ matrix.branches }}
35+
continue-on-error: true
36+
37+
- name: Read package.json node and npm engines version
38+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
39+
id: versions
40+
with:
41+
fallbackNode: '^20'
42+
fallbackNpm: '^10'
43+
44+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
45+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
46+
with:
47+
node-version: ${{ steps.versions.outputs.nodeVersion }}
48+
49+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
50+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
51+
52+
- name: Fix npm audit
53+
id: npm-audit
54+
uses: nextcloud-libraries/npm-audit-action@2a60bd2e79cc77f2cc4d9a3fe40f1a69896f3a87 # v0.1.0
55+
56+
- name: Run npm ci and npm run build
57+
if: steps.checkout.outcome == 'success'
58+
env:
59+
CYPRESS_INSTALL_BINARY: 0
60+
run: |
61+
npm ci
62+
npm run build --if-present
63+
64+
- name: Create Pull Request
65+
if: steps.checkout.outcome == 'success'
66+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
67+
with:
68+
token: ${{ secrets.COMMAND_BOT_PAT }}
69+
commit-message: 'fix(deps): Fix npm audit'
70+
committer: GitHub <noreply@github.com>
71+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
72+
signoff: true
73+
branch: automated/noid/${{ matrix.branches }}-fix-npm-audit
74+
title: '[${{ matrix.branches }}] Fix npm audit'
75+
body: ${{ steps.npm-audit.outputs.markdown }}
76+
labels: |
77+
dependencies
78+
3. to review

0 commit comments

Comments
 (0)