Skip to content

Commit

Permalink
another fix for the following step
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed Aug 14, 2024
1 parent 56570b3 commit 839095f
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/publish_docker_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,28 @@ jobs:
MATRIX_JSON: ${{ env.matrix_json }}
with:
script: |
const matrix = JSON.parse(process.env.MATRIX_JSON);
const { github, context } = require('@actions/github');
const { MATRIX_JSON } = process.env;
const matrix = JSON.parse(MATRIX_JSON);
console.log("Triggering workflows: ", matrix);
for (const workflow of matrix) {
const owner = context.repo.owner;
const repo = context.repo.repo;
const event_type = 'trigger-workflow'; // Matches the repository_dispatch trigger
const client_payload = { "branch": process.env.GITHUB_REF_NAME };
await github.repos.createDispatchEvent({
owner,
repo,
event_type,
client_payload,
workflow
});
};
const owner = context.repo.owner;
const repo = context.repo.repo;
const event_type = 'trigger-workflow'; // Make sure this matches your repository_dispatch trigger
for (const workflow of matrix) {
try {
await github.rest.repos.createDispatchEvent({
owner,
repo,
event_type,
client_payload: {
workflow: workflow,
branch: process.env.GITHUB_REF_NAME
}
});
console.log(`Triggered ${workflow}`);
} catch (error) {
console.error(`Failed to trigger ${workflow}:`, error);
}
}

0 comments on commit 839095f

Please sign in to comment.