diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 4f2da0e..c665f75 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,13 +2,12 @@ name: CD on: push: - branches: - - production - tags-ignore: - - "**" + branches: [production] + tags-ignore: ["**"] jobs: release: + if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }} permissions: contents: write issues: write diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f909b7e..31b8786 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,25 @@ -name: "CI" +name: CI on: push: branches: - - "master" - - "hotfix/**" + - master + - "hotfix/*" paths-ignore: - ".github/**" - "!.github/workflows/ci.yml" - - ".gitignore" + - .gitignore - "docs/**" - - "README.md" - - "LICENSE" - workflow_call: + - README.md + - LICENSE + pull_request: + paths-ignore: + - ".github/**" + - "!.github/workflows/ci.yml" + - .gitignore + - "docs/**" + - README.md + - LICENSE jobs: build: @@ -44,7 +51,3 @@ jobs: - name: Test Site run: bash tools/test.sh - - check-commit: - needs: build - uses: ./.github/workflows/commitlint.yml diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index ac8726f..58f1a3f 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,6 +1,11 @@ name: Lint Commit Messages -on: workflow_call +on: + push: + branches: + - master + - "hotfix/*" + pull_request: jobs: commitlint: diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index fe393a2..42e1d64 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -19,15 +19,6 @@ jobs: uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} - result-encoding: string script: | const script = require('.github/workflows/scripts/pr-filter.js'); - return await script({ github, context }); - - - name: Abort due to invalid PR - if: ${{ steps.intercept.outputs.result != 'true' }} - run: exit 1 - - test: - needs: check-template - uses: ./.github/workflows/ci.yml + await script({ github, context, core }); diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 99114ea..b0f9713 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,6 +10,7 @@ on: required: true BUILDER: required: true + workflow_dispatch: jobs: launch: diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index f4190dd..9724201 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -1,5 +1,5 @@ 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) { @@ -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 body = pr.body === null ? '' : pr.body.trim(); + const body = pr.body === null ? '' : pr.body; const markdown = body.replace(//g, ''); const action = context.payload.action; @@ -31,7 +31,7 @@ module.exports = async ({ github, context }) => { issue_number: pr.number, 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.'); + } }; diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index f84f3bc..5cb38a7 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -1,8 +1,10 @@ -name: "Style Lint" +name: Style Lint on: push: - branches: ["master", "hotfix/**"] + branches: + - master + - "hotfix/*" paths: ["_sass/**/*.scss"] pull_request: paths: ["_sass/**/*.scss"]