Skip to content

Commit

Permalink
ci: fix test.yml workflow_id
Browse files Browse the repository at this point in the history
  • Loading branch information
uhobeike committed May 13, 2024
1 parent a8ebccd commit 7f04bd6
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,34 @@ jobs:
script: |
async function run() {
const { owner, repo } = context.repo;
const workflow_id = context.workflow.id;
let workflow_id = context.workflow.id;
const ref = context.ref;
const run_id = context.runId;
const workflow_run = await github.rest.actions.getWorkflowRun({
owner,
repo,
run_id
});
if (!workflow_id) {
workflow_id = 'test.yml';
}
if (workflow_run.data.run_attempt < 10) {
console.log('Triggering workflow dispatch...');
await github.rest.actions.createWorkflowDispatch({
try {
const workflow_run = await github.rest.actions.getWorkflowRun({
owner,
repo,
workflow_id,
ref
run_id
});
} else {
console.log('Conditions not met for re-dispatch.');
if (workflow_run.data.run_attempt < 10) {
console.log('Triggering workflow dispatch...');
await github.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id,
ref
});
} else {
console.log('Conditions not met for re-dispatch.');
}
} catch (error) {
console.error('Failed to fetch workflow run or dispatch:', error);
}
}
run();

0 comments on commit 7f04bd6

Please sign in to comment.