I have a very simple requirement for new PRs, and that is that at least one label must be specified. However I have no access to any runner.
I am able to check for the existence of an applied label using the context expressions which are applied before any runner:
name: Compliance
on:
pull_request:
jobs:
compliance:
if: |
contains(github.event.issue.labels.*.name, 'bug') ||
contains(github.event.issue.labels.*.name, 'dependencies') ||
contains(github.event.issue.labels.*.name, 'enhancement')
// fail
if:
contains(github.event.issue.labels.*.name, 'bug') ||
contains(github.event.issue.labels.*.name, 'dependencies') ||
contains(github.event.issue.labels.*.name, 'enhancement')
// pass
It seems like there’s no way to explicitly fail or pass a workflow without doing so within the runner. Is there no way to explicitly fail (or pass) a workflow before any step is ever run?
6
This workflow does not need a runner as it will be skipped while the title will show true
or false
based on the presence of labels.
name: Compliance
on:
pull_request:
run-name: |
Compliance labels present: ${{ contains(github.event.issue.labels.*.name, 'bug') ||
contains(github.event.issue.labels.*.name, 'dependencies') ||
contains(github.event.issue.labels.*.name, 'enhancement') }}
jobs:
never-run:
runs-on: ubuntu-latest
if: false
steps:
- run: echo Never run
1