Skip to content

GitHub Actions that retrieves the values of selected checkboxes for workflow_dispatch events

License

Notifications You must be signed in to change notification settings

joao-zanutto/get-selected

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Get Selected

GitHub Super-Linter CI

This action returns a list with the names of selected checkboxes from the input of a workflow_dispatch event. It supports the use of custom separator strings and an ignore list, which will be ignored from the output.

Usage

Here's an example of how to use this action in a workflow file:

on:
  workflow_dispatch:
    inputs: # Example inputs
      api:
        type: boolean
      worker1:
        type: boolean
      worker2:
        type: boolean

jobs:
  get-selected:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - id: get-selected-step
        uses: joao-zanutto/[email protected]

      - run: echo ${{ steps.get-selected-step.outputs.selected }}

Working example

Running the workflow:

image

Will generate the following output:

image

Referencing the output on a different job

jobs:
  get-selected:
    runs-on: ubuntu-latest
    outputs: # Set this to consume the output on other job
      selected: ${{ steps.get-selected-step.outputs.selected}}
    steps:
      - uses: actions/checkout@v4

      - id: get-selected-step
        uses: joao-zanutto/[email protected]

  consume-on-another-job:
    runs-on: ubuntu-latest
    needs: get-selected
    steps:
      - run: echo ${{ needs.get-selected.outputs.selected }}

Inputs

Input Required Default Description
ignore false null Comma-separated options to ignore
format false 'list' Output format. list or json
separator false ' ' Separator; only vaid for format: list

Outputs

Output Description
selected Names of the selected checkboxes