From 9dd99d64961117605da3e9999c73dfb0bda3bbee Mon Sep 17 00:00:00 2001 From: Sander Devisscher Date: Fri, 23 Aug 2024 16:32:43 +0200 Subject: [PATCH] fix #74 attempt 1 --- .../workflows/trigger_build_pkgdown_site.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/trigger_build_pkgdown_site.yaml b/.github/workflows/trigger_build_pkgdown_site.yaml index 6ee50b7..8610620 100644 --- a/.github/workflows/trigger_build_pkgdown_site.yaml +++ b/.github/workflows/trigger_build_pkgdown_site.yaml @@ -14,15 +14,11 @@ jobs: uses: actions/github-script@v6 with: script: | - const { exec } = require('child_process'); - exec('gh workflow run "Build pkgdown site"', (error, stdout, stderr) => { - if (error) { - console.error(`Error: ${error.message}`); - return; - } - if (stderr) { - console.error(`Stderr: ${stderr}`); - return; - } - console.log(`Stdout: ${stdout}`); + const workflow_id = "Build pkgdown site"; // The name of the workflow to trigger + const response = await github.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id, + ref: context.ref, // The branch or tag to run the workflow on }); + console.log(`Triggered workflow: ${response.data.message}`);