Skip to content

Commit 3ff1134

Browse files
committed
chore(ci): add new workflows
Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 55dd5f2 commit 3ff1134

File tree

4 files changed

+202
-0
lines changed

4 files changed

+202
-0
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: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block merges for EOL
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: block-merge-eol-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
block-merges-eol:
22+
name: Block merges for EOL branches
23+
24+
# Only run on stableXX branches
25+
if: startsWith( github.base_ref, 'stable')
26+
runs-on: ubuntu-latest-low
27+
28+
steps:
29+
- name: Set server major version environment
30+
uses: actions/github-script@v7
31+
with:
32+
github-token: ${{secrets.GITHUB_TOKEN}}
33+
script: |
34+
const regex = /^stable(\d+)$/
35+
const baseRef = context.payload.pull_request.base.ref
36+
const match = baseRef.match(regex)
37+
if (match) {
38+
console.log('Setting server_major to ' + match[1]);
39+
core.exportVariable('server_major', match[1]);
40+
console.log('Setting current_month to ' + (new Date()).toISOString().substr(0, 7));
41+
core.exportVariable('current_month', (new Date()).toISOString().substr(0, 7));
42+
}
43+
44+
- name: Checking if server ${{ env.server_major }} is EOL
45+
if: ${{ env.server_major != '' }}
46+
run: |
47+
curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json \
48+
| jq '.["${{ env.server_major }}"]["eol"] // "9999-99" | . >= "${{ env.current_month }}"' \
49+
| grep -q true
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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: 2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Block unconventional commits
10+
11+
on:
12+
pull_request:
13+
types: [opened, ready_for_review, reopened, synchronize]
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: block-unconventional-commits-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
block-unconventional-commits:
24+
name: Block unconventional commits
25+
26+
runs-on: ubuntu-latest-low
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: false
33+
34+
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
35+
with:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/fixup.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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: Block fixup and squash commits
10+
11+
on:
12+
pull_request:
13+
types: [opened, ready_for_review, reopened, synchronize]
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: fixup-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
commit-message-check:
24+
if: github.event.pull_request.draft == false
25+
26+
permissions:
27+
pull-requests: write
28+
name: Block fixup and squash commits
29+
30+
runs-on: ubuntu-latest-low
31+
32+
steps:
33+
- name: Run check
34+
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
35+
with:
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
branches: ['main', 'master', 'stable31', 'stable30', 'stable29']
28+
29+
name: npm-audit-fix-${{ matrix.branches }}
30+
31+
steps:
32+
- name: Checkout
33+
id: checkout
34+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
persist-credentials: false
37+
ref: ${{ matrix.branches }}
38+
continue-on-error: true
39+
40+
- name: Read package.json node and npm engines version
41+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
42+
id: versions
43+
with:
44+
fallbackNode: '^20'
45+
fallbackNpm: '^10'
46+
47+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
48+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
49+
with:
50+
node-version: ${{ steps.versions.outputs.nodeVersion }}
51+
52+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
53+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
54+
55+
- name: Fix npm audit
56+
id: npm-audit
57+
uses: nextcloud-libraries/npm-audit-action@2a60bd2e79cc77f2cc4d9a3fe40f1a69896f3a87 # v0.1.0
58+
59+
- name: Run npm ci and npm run build
60+
if: steps.checkout.outcome == 'success'
61+
env:
62+
CYPRESS_INSTALL_BINARY: 0
63+
run: |
64+
npm ci
65+
npm run build --if-present
66+
67+
- name: Create Pull Request
68+
if: steps.checkout.outcome == 'success'
69+
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
70+
with:
71+
token: ${{ secrets.COMMAND_BOT_PAT }}
72+
commit-message: 'fix(deps): Fix npm audit'
73+
committer: GitHub <[email protected]>
74+
author: nextcloud-command <[email protected]>
75+
signoff: true
76+
branch: automated/noid/${{ matrix.branches }}-fix-npm-audit
77+
title: '[${{ matrix.branches }}] Fix npm audit'
78+
body: ${{ steps.npm-audit.outputs.markdown }}
79+
labels: |
80+
dependencies
81+
3. to review

0 commit comments

Comments
 (0)