Skip to content

Commit

Permalink
fix: print more debug logs when fetching run id
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jul 2, 2020
1 parent fc8a4eb commit 54c7f02
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5894,6 +5894,10 @@ const getCiBuildId = async () => {
let parallelId = `${GITHUB_WORKFLOW} - ${GITHUB_SHA}`

if (GITHUB_TOKEN) {
core.debug(
`Determining build id by asking GitHub about run ${GITHUB_RUN_ID}`
)

const client = new Octokit({
auth: GITHUB_TOKEN
})
Expand All @@ -5909,7 +5913,7 @@ const getCiBuildId = async () => {

if (resp && resp.data && resp.data.head_branch) {
branch = resp.data.head_branch
// core.exportVariable('GH_BRANCH', resp.data.head_branch)
core.debug(`found the branch name ${branch}`)
}

const runsList = await client.request(
Expand All @@ -5925,7 +5929,12 @@ const getCiBuildId = async () => {
// Use the total_count, every time a job is restarted the list has
// the number of jobs including current run and previous runs, every time
// it appends the result.
core.debug(
`fetched run list with ${runsList.data.total_count} records`
)
parallelId = `${GITHUB_RUN_ID}-${runsList.data.total_count}`
} else {
core.debug('could not get run list')
}
}

Expand Down
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ const getCiBuildId = async () => {
let parallelId = `${GITHUB_WORKFLOW} - ${GITHUB_SHA}`

if (GITHUB_TOKEN) {
core.debug(
`Determining build id by asking GitHub about run ${GITHUB_RUN_ID}`
)

const client = new Octokit({
auth: GITHUB_TOKEN
})
Expand All @@ -332,7 +336,7 @@ const getCiBuildId = async () => {

if (resp && resp.data && resp.data.head_branch) {
branch = resp.data.head_branch
// core.exportVariable('GH_BRANCH', resp.data.head_branch)
core.debug(`found the branch name ${branch}`)
}

const runsList = await client.request(
Expand All @@ -348,7 +352,12 @@ const getCiBuildId = async () => {
// Use the total_count, every time a job is restarted the list has
// the number of jobs including current run and previous runs, every time
// it appends the result.
core.debug(
`fetched run list with ${runsList.data.total_count} records`
)
parallelId = `${GITHUB_RUN_ID}-${runsList.data.total_count}`
} else {
core.debug('could not get run list')
}
}

Expand Down

0 comments on commit 54c7f02

Please sign in to comment.