Skip to content

Bug: github.job is empty in jobs.if #25660

Answered by mvlasovatl
mvlasovatl asked this question in Actions
Discussion options

You must be logged in to vote

Yeah, that might work as well. In my case though the job contains up to 10 steps, so it would be inconvenient to paste that boilerplate code to every step. I managed to achieve the logic I wanted by hard-coding of the job ID in if clause:

on:
  workflow_dispatch:
    inputs:
      jobs:
        description: Jobs to run (defaults to all)
        required: false
jobs:    
  unit-tests:
    runs-on: ubuntu-latest
    if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'unit-tests')

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants