Skip to content

Commit

Permalink
ci: get latest workflow run id
Browse files Browse the repository at this point in the history
  • Loading branch information
levisingularity committed Jul 19, 2024
1 parent e2bce45 commit 647d9dd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/invoke-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,31 @@ jobs:
const ref = '${{ inputs.ref }}';
const owner = context.repo.owner;
const result = await github.rest.actions.createWorkflowDispatch({
await github.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id,
ref,
});
console.log(result)
- name: Get workflow run_id
uses: actions/github-script@v6
with:
script: |-
const owner = context.repo.owner;
const workflow_id = '${{ inputs.workflow }}';
const repo = '${{ inputs.repo }}';
const runs = await github.rest.actions.listWorkflowRuns({
owner,
repo,
workflow_id,
per_page: 1,
});
console.log(runs);
const run_id = result.run_id;
const run_id = runs[0].id;
core.setOutput('run-id', run_id);
Expand Down

0 comments on commit 647d9dd

Please sign in to comment.