Skip to content

Commit

Permalink
fix: action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasreimers committed Mar 31, 2024
1 parent 4e25572 commit d0314ff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 46 deletions.
33 changes: 13 additions & 20 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

40 changes: 15 additions & 25 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,6 @@ async function requestAndCancelWorkflow({
return
}

const octokit = github.getOctokit(github_token)
const { GITHUB_RUN_ID } = process.env

const response = await octokit.rest.actions.cancelWorkflowRun({
owner,
repo,
run_id: Number(GITHUB_RUN_ID)
})

console.log(response)

await sleep(10)

if (!process.env.NEVER) {
return
}

if (result.status !== 200) {
core.warning(
'Response returned a non-200 status. Skipping Graphite checks.'
Expand All @@ -105,14 +88,21 @@ async function requestAndCancelWorkflow({
} = await result.json()

if (body.skip) {
// const octokit = github.getOctokit(github_token)
// const { GITHUB_RUN_ID } = process.env
//
// await octokit.rest.actions.cancelWorkflowRun({
// owner,
// repo,
// run_id: Number(GITHUB_RUN_ID)
// })
const octokit = github.getOctokit(github_token)
const { GITHUB_RUN_ID } = process.env

await octokit.rest.actions.cancelWorkflowRun({
owner,
repo,
run_id: Number(GITHUB_RUN_ID)
})

/**
* When you cancel the job, it takes a few seconds to register.
*
* Give the job a few seconds to get cancelled before continuing to the real work.
*/
await sleep(10)
}
} catch {
core.warning('Failed to parse response body. Skipping Graphite checks.')
Expand Down

0 comments on commit d0314ff

Please sign in to comment.