ci: improve workflow triggers (#2017)
- Unchain commit-lint and CI - Even if a commit does not meet the CI path filter, it still needs to lint the commit message. - Unchain PR filter and CI - The CI workflow needs to be triggered when the commits in a pull request are modified. - Allow manual publishing - Sometimes `semantic-release` will error out due to commit messages referencing discussions, but this does not affect the final RubyGems/GitHub Release. In such cases, manual triggering of the publish process is needed to complete the remaining publishing steps.
This commit is contained in:
parent
c7f967529c
commit
4ef3cd8efc
7 changed files with 34 additions and 33 deletions
7
.github/workflows/cd.yml
vendored
7
.github/workflows/cd.yml
vendored
|
@ -2,13 +2,12 @@ name: CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [production]
|
||||||
- production
|
tags-ignore: ["**"]
|
||||||
tags-ignore:
|
|
||||||
- "**"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
issues: write
|
issues: write
|
||||||
|
|
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
|
@ -1,18 +1,25 @@
|
||||||
name: "CI"
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- master
|
||||||
- "hotfix/**"
|
- "hotfix/*"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
- ".github/**"
|
||||||
- "!.github/workflows/ci.yml"
|
- "!.github/workflows/ci.yml"
|
||||||
- ".gitignore"
|
- .gitignore
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "README.md"
|
- README.md
|
||||||
- "LICENSE"
|
- LICENSE
|
||||||
workflow_call:
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- ".github/**"
|
||||||
|
- "!.github/workflows/ci.yml"
|
||||||
|
- .gitignore
|
||||||
|
- "docs/**"
|
||||||
|
- README.md
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -44,7 +51,3 @@ jobs:
|
||||||
|
|
||||||
- name: Test Site
|
- name: Test Site
|
||||||
run: bash tools/test.sh
|
run: bash tools/test.sh
|
||||||
|
|
||||||
check-commit:
|
|
||||||
needs: build
|
|
||||||
uses: ./.github/workflows/commitlint.yml
|
|
||||||
|
|
7
.github/workflows/commitlint.yml
vendored
7
.github/workflows/commitlint.yml
vendored
|
@ -1,6 +1,11 @@
|
||||||
name: Lint Commit Messages
|
name: Lint Commit Messages
|
||||||
|
|
||||||
on: workflow_call
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- "hotfix/*"
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
commitlint:
|
commitlint:
|
||||||
|
|
11
.github/workflows/pr-filter.yml
vendored
11
.github/workflows/pr-filter.yml
vendored
|
@ -19,15 +19,6 @@ jobs:
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
result-encoding: string
|
|
||||||
script: |
|
script: |
|
||||||
const script = require('.github/workflows/scripts/pr-filter.js');
|
const script = require('.github/workflows/scripts/pr-filter.js');
|
||||||
return await script({ github, context });
|
await script({ github, context, core });
|
||||||
|
|
||||||
- name: Abort due to invalid PR
|
|
||||||
if: ${{ steps.intercept.outputs.result != 'true' }}
|
|
||||||
run: exit 1
|
|
||||||
|
|
||||||
test:
|
|
||||||
needs: check-template
|
|
||||||
uses: ./.github/workflows/ci.yml
|
|
||||||
|
|
1
.github/workflows/publish.yml
vendored
1
.github/workflows/publish.yml
vendored
|
@ -10,6 +10,7 @@ on:
|
||||||
required: true
|
required: true
|
||||||
BUILDER:
|
BUILDER:
|
||||||
required: true
|
required: true
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
launch:
|
launch:
|
||||||
|
|
10
.github/workflows/scripts/pr-filter.js
vendored
10
.github/workflows/scripts/pr-filter.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
function hasTypes(markdown) {
|
function hasTypes(markdown) {
|
||||||
return /## Type of change/.test(markdown) && /-\s*\[x\]/i.test(markdown);
|
return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasDescription(markdown) {
|
function hasDescription(markdown) {
|
||||||
|
@ -9,9 +9,9 @@ function hasDescription(markdown) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = async ({ github, context }) => {
|
module.exports = async ({ github, context, core }) => {
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
const body = pr.body === null ? '' : pr.body.trim();
|
const body = pr.body === null ? '' : pr.body;
|
||||||
const markdown = body.replace(/<!--[\s\S]*?-->/g, '');
|
const markdown = body.replace(/<!--[\s\S]*?-->/g, '');
|
||||||
const action = context.payload.action;
|
const action = context.payload.action;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ module.exports = async ({ github, context }) => {
|
||||||
issue_number: pr.number,
|
issue_number: pr.number,
|
||||||
body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.`
|
body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.`
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return isValid;
|
core.setFailed('PR content does not meet template requirements.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
6
.github/workflows/style-lint.yml
vendored
6
.github/workflows/style-lint.yml
vendored
|
@ -1,8 +1,10 @@
|
||||||
name: "Style Lint"
|
name: Style Lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["master", "hotfix/**"]
|
branches:
|
||||||
|
- master
|
||||||
|
- "hotfix/*"
|
||||||
paths: ["_sass/**/*.scss"]
|
paths: ["_sass/**/*.scss"]
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: ["_sass/**/*.scss"]
|
paths: ["_sass/**/*.scss"]
|
||||||
|
|
Loading…
Reference in a new issue