Bug workflow

Report a typo

You have a GitHub repository with a workflow that is triggered by the issues event. The workflow has a job that runs on Ubuntu and prints the issue number, title, and body to the console. A user opens a new issue in the repository and adds the label "bug" to it. How can you modify the workflow to run only when an issue is opened with the "bug" label?

name: Bug Workflow
on:
  issues:
    types: [opened]

jobs:
  bug_job:
    runs-on: ubuntu-latest
    env:
      ISSUE_NUMBER: ${{ github.event.issue.number }}
      ISSUE_TITLE: ${{ github.event.issue.title }}
      ISSUE_BODY: ${{ github.event.issue.body }}
    steps:
      - name: Print issue details
        run: |
          echo "Issue number: $ISSUE_NUMBER"
          echo "Issue title: $ISSUE_TITLE"
          echo "Issue body: $ISSUE_BODY"
Select one option from the list
___

Create a free account to access the full topic