Skip to content

Commit 74280c2

Browse files
authored
fix: workflow run always executes as the latest commit
1 parent 251cb08 commit 74280c2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

action/lib/deduplicate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ import { inspect } from 'util'
77
import core from '@actions/core'
88
import github from '@actions/github'
99

10-
export default async function ({ octokit, workflow_id, run_id, sha }) {
10+
export default async function ({ octokit, workflow_id, run_id }) {
1111
// get current run of this workflow
1212
const { data: { workflow_runs } } = await octokit.request('GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs', {
1313
...github.context.repo,
1414
per_page: 100,
1515
workflow_id
1616
})
1717

18+
const { sha } = github.context
19+
1820
// filter and sort
1921
const cancellable = workflow_runs
2022
// filter to relevant runs

action/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default async function ({ token, delay, timeout, sha, ignore }) {
3232
core.debug(`workflow_id: ${workflow_id}`)
3333

3434
// don't run this workflow twice for the same commit
35-
await deduplicate({ octokit, workflow_id, run_id, sha })
35+
await deduplicate({ octokit, workflow_id, run_id })
3636

3737
// find all the dependencies
3838
const dependencies = await workflows({ octokit, ref, workflow_id })

0 commit comments

Comments
 (0)