The pull-request.yaml Action may not need to trigger the code checks and tests:
|
build: |
|
needs: conventional-commits |
|
uses: ./.github/workflows/build.yaml |
|
permissions: |
|
contents: read |
if the PR is in “draft” mode — the event payload has a boolean "draft"
:
build:
needs: conventional-commits
if: ${{ !github.event.pull_request.draft }}
that we should be able to check. A draft PR by definition is incomplete and may or may not pass checks and tests…
Furthermore, I am tempted to change this
|
pull_request: |
|
branches: |
|
- main |
|
- staging |
to
pull_request:
branches:
- *
to target all PRs regardless of their base branch (i.e. PRs that target other PRs).
We also don’t need to run checks and tests if the PR body discussion has had an entry but there was no code change. In that case, maybe only run cz
(because the PR title was changed), for example:
build:
needs: conventional-commits
if: ${{ github.event.action !== 'edited' }}
Skipping the build
job, however, means that no artifacts are produced by that particular Action run, which is probably acceptable.