Skip to content
CodeKruPro

Read the workflow: start it by hand with a choice

QuizMedium

Read the workflow.

.github/workflows/api-tests.yml

name: api-tests

on:
  pull_request:
  schedule:
    - cron: "30 1 * * *"
  workflow_dispatch:
    inputs:
      groups:
        description: TestNG groups to run
        type: choice
        options: [smoke, regression]
        default: smoke

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-java@v6
        with:
          distribution: temurin
          java-version: "21"
          cache: maven
      - name: Run tests
        run: mvn -B test -Dgroups=${{ inputs.groups || 'smoke' }}
        env:
          API_TOKEN: ${{ secrets.API_TOKEN }}
      - uses: actions/upload-artifact@v7
        if: failure()
        with:
          name: surefire-reports
          path: target/surefire-reports/

Someone starts it from the Actions tab with "Run workflow" and picks regression. What happens?

  • mvn -B test -Dgroups=regression runs, and surefire reports are uploaded only if the job fails
  • mvn -B test -Dgroups=smoke runs, because smoke is the default
  • Nothing: workflows with a schedule cannot be started by hand
  • The reports are always uploaded

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in