See it on the πͺ marketplace.
Suggests dispatchable workflows for a branch that would otherwise trigger the dispatchable workflows from pushes to the trunk.
- name: Dispatch π€ Suggestor π₯
uses: Skenvy/dispatch-suggestor@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}Embed the action in a workflow triggered on pull_request events, and it will determine a list of workflows with workflow_dispatch triggers that would also be triggered on push to the trunk branch (but that aren't triggered by pushing to the PR's head branch).
E.g. if you have several workflow_dispatch based workflows that are each also triggered by pushes to the trunk branch but limited to specific file triggers, this action will evaluate the changes in the PR and determine for each dispatchable workflow if they are relevant or not, and then suggest the ones it considers relevant.
- Required
- Requires that the workflow or job have
permissionsset to at leastpermissions: actions: read contents: read pull-requests: write
- Optional
- Name of the trunk branch, if not main.
- Default
'main'.
- Optional
- The path to the root folder of the checked out repo, relative to the default working-directory,
$GITHUB_WORKSPACE. It should be the same as the value provided to@actions/checkoutwith.path:, or default. - Default
'.'.
- Optional
- The maximum number of workflows to paginate over from the
list-repository-workflowsAPI. An input of0will retrieve all. - Default
100.
- Optional
- A hidden string the action can use to identify any previously written comment, to edit it rather than add indefinitely. Only useful if you're using this action with multiple configurations on the same PR.
- Default
'DEFAULT_COMMENT_UNIQUE_IDENTIFIER'.
- Optional
- A comma-separated list of paths to inject into the list of changed files.
- Default
''.
- Optional
- If not false, will print the whole triggering event payload.
- Default
'false'.
- Optional
- If not false, will print the triggers for all dispatchable workflows.
- Default
'false'.
- Optional
- Very very verbose. Include debugging logs.
- Default
'false'.
- A list of the files that have been touched by this PR.
- A list of the workflows found in this repo that have
workflow_dispatchtriggers.
- For a
deployment_branchofmain. - Use
on.pull_request.paths-ignoreif there're any paths you're certain won't ever trigger any other workflow.
on:
pull_request:
branches:
- 'main'- Prior to the
uses: Skenvy/dispatch-suggestor@v1step, you'll need tocheckout, as this action checks the local state of workflows.
- name: π Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/*.y*ml
sparse-checkout-cone-mode: false- With the deployment branch being
main, and thecheckoutabove, in the least decorated way;
- uses: Skenvy/dispatch-suggestor@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}See this example here.
name: Dispatch π€ Suggestor π₯
on:
pull_request:
permissions:
actions: read
contents: read
pull-requests: write
jobs:
suggestor:
name: Dispatch π€ Suggestor π₯
runs-on: 'ubuntu-latest'
steps:
- name: π Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/*.y*ml
sparse-checkout-cone-mode: false
- name: Dispatch π€ Suggestor π₯
id: dispatch-suggestor
uses: Skenvy/dispatch-suggestor@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: List changed files
run: echo "${{ steps.dispatch-suggestor.outputs.list-of-changed-files }}"
- name: List dispatchable workflows
run: echo "${{ steps.dispatch-suggestor.outputs.list-of-dispatchable-workflows }}"