JobIdNaming
¶
Job should have a lower-case kebab ID.
Defined by IdNamingRule
which supports workflows, actions in the "Default" ruleset along with WorkflowIdNaming
, StepIdNaming
.
Description¶
The Job id must start with a letter or _ and contain only alphanumeric characters, -, or _. -- jobs.
-- Setting an ID for a job
Job IDs appear
- as name of Jobs when their name is not set
- in the
needs
list of another job to express dependencies - in the
outputs
declarations ofworkflow_call
s - in
if
conditions e.g.needs.other-job.outputs.some-output
They're allowed to have _
in the name,
however, conventionally it's best to use lower-kebab-case naming for job names
as it's consistent with the rest of GitHub's Workflow syntax, for example runs-on
, timeout-minutes
.
Using kebab case also helps to distinguish their IDs from
- event names (lower_snake_case)
- placeholders (
<job_id>
) - payload fields (
pull_request.auto_merge
)
Compliant example¶
Jobs have conventional lower-kebab-case IDs.
example.yml
on: push jobs: example: runs-on: ubuntu-latest needs: [ something-else ] steps: - run: echo "Example" something-else: runs-on: ubuntu-latest steps: - run: echo "Example"
Non-compliant example¶
Jobs have non-lower-kebab-case IDs, and their IDs are inconsistent with each other.
example.yml
on: push jobs: EXAMPLE: runs-on: ubuntu-latest needs: [ something_else ] steps: - run: echo "Example" something_else: runs-on: ubuntu-latest steps: - run: echo "Example"
- Line 3: Job[EXAMPLE] should have a lower-case kebab ID.
- Line 9: Job[something_else] should have a lower-case kebab ID.