How can I filter for "Issue Type" within a Job? #167248
-
| Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Workflow Configuration Discussion DetailsWe currently have some workflows that run on issue:opened. Current: name: Project Management
on:
  issues:
    types:
      - opened
jobs:
  bug-job:
    name: Job for bug
    if: contains(github.event.issue.labels.*.name, 'bug')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4Expectation: name: Project Management
on:
  issues:
    types:
      - opened
jobs:
  bug-job:
    name: Job for bug
    if: github.event.issue.type == 'bug'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4I cannot find the field in the REST API and therefore think it is not available? | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
| Hey!, I actually ran into this same issue recently | 
Beta Was this translation helpful? Give feedback.
-
| at the moment issue types aren't exposed in the webhook payload yet, the github.event.issue.type field doesn't exist in Actions context. Current workaround: Keep using labels for now, but automate the label assignment based on issue type: i think issue types are still relatively new therefore GitHub hasn't updated the webhook schema to include them yet, stick with labels until they add native support | 
Beta Was this translation helpful? Give feedback.
Hey!, I actually ran into this same issue recently
You’re right: unfortunately, github.event.issue.type doesn’t exist (yet). Even though GitHub now supports issue types like “bug” and “task”, those aren’t currently exposed in the GitHub Actions event payload or REST API — at least not in a way we can directly filter on in the workflow.
So the if: github.event.issue.type == 'bug' check won’t work right now.
so you can try :
If you’re using issue forms (YAML templates in .github/ISSUE_TEMPLATE/), you can add a hidden field to store the issue type, like this:
name: Type
id: type
type: hidden
value: bug
Then in your workflow, you can do something like:
if: contains(github.event.issue.body, 'v…