-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f82e3c
commit abe2eeb
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Invoke Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repo: | ||
description: "Repository name" | ||
required: true | ||
workflow: | ||
description: "Workflow name" | ||
required: true | ||
ref: | ||
description: "Git reference (branch or tag) to run the workflow on" | ||
required: true | ||
default: "master" | ||
|
||
jobs: | ||
invoke: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Invoke workflow without inputs. Wait for result | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const workflow = '${{ github.event.inputs.workflow }}'; | ||
const repo = '${{ matrix.repo }}'; | ||
const ref = '${{ github.event.inputs.ref }}'; | ||
const token = '${{ secrets.GH_TOKEN }}'; | ||
const octokit = require('@octokit/rest')({ | ||
auth: token, | ||
}); | ||
await octokit.actions.createWorkflowDispatch({ | ||
owner: context.repo.owner, | ||
repo: repo, | ||
workflow_id: workflow, | ||
ref: ref, | ||
}); |