diff --git a/.github/workflows/check-repos.yml b/.github/workflows/check-repos.yml index b4933c7..b15fcf2 100644 --- a/.github/workflows/check-repos.yml +++ b/.github/workflows/check-repos.yml @@ -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 }} diff --git a/.github/workflows/invoke-workflow.yml b/.github/workflows/invoke-workflow.yml new file mode 100644 index 0000000..a7062e5 --- /dev/null +++ b/.github/workflows/invoke-workflow.yml @@ -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, + });