From 6944b97777f6356efd685a561c51a5aec67dddb0 Mon Sep 17 00:00:00 2001 From: David James Date: Tue, 6 Aug 2024 10:27:37 -0400 Subject: [PATCH] Update workflow_dispatch API call * Add new triggers for tests * Update actions url * Update API call * Add URL to Github docs --- .github/workflows/test.yml | 8 +++++++- README.md | 3 +++ entrypoint.sh | 8 +++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ac96b0..35d29ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,12 @@ on: - master push: + workflow_dispatch: + + # 11pm UTC; 7/8am EST/EDT + schedule: + - cron: '0 11 * * *' + jobs: test_action: @@ -12,7 +18,7 @@ jobs: steps: - name: Trigger pipeline - uses: mego22/actions-workflow-pipeline@post-data + uses: mego22/actions-workflow-pipeline@fix-update-workflow_dispatch-call with: token: "${{ secrets.TOKEN }}" dispatch: '[{"org": "mego22" ,"repo": "actions-workflow-pipeline", "branch": "main", "workflow": "trigger1.yml"}, diff --git a/README.md b/README.md index 95edc4b..298a2af 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # actions-workflow-pipeline Trigger additional workflows +Github docs for the action: +https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event + ## Usage ### Trigger one or more workflows ``` diff --git a/entrypoint.sh b/entrypoint.sh index 143ef0c..e0e9b7d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,6 +21,7 @@ check_commands() { } +# https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event trigger_dispatches() { for dispatch in `echo "${DISPATCHES}" | jq -c .[]` do @@ -39,10 +40,11 @@ EOF echo "Triggering $WORKFLOW for $REPO." echo "::endgroup::" - curl -qs \ + curl -L \ -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token ${GIT_TOKEN}" \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${GIT_TOKEN}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/${ORG}/${REPO}/actions/workflows/${WORKFLOW}/dispatches \ -d "$(_post_data)"