Skip to content

Commit

Permalink
ci: invoke workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
levisingularity committed Jul 17, 2024
1 parent 5f82e3c commit abe2eeb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/check-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
repo: ${{ fromJson(needs.outputs.scheduled-repos) }}
steps:
- name: Invoke workflow without inputs. Wait for result
uses: the-actions-org/workflow-dispatch@v4
uses: singnet/das/.github/workflows/invoke-workflow.yml@master
with:
workflow: ${{ matrix.repo.name }}
repo: ${{ matrix.repo.repo }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/invoke-workflow.yml
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,
});

0 comments on commit abe2eeb

Please sign in to comment.