ci: fix coverage-action outputs + gh token common
This commit is contained in:
parent
ea6c9316d4
commit
8ef90059f5
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -18,7 +18,7 @@ on:
|
|||
summary:
|
||||
description: 'Summary'
|
||||
required: false
|
||||
type: text
|
||||
type: string
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
|
@ -231,7 +231,7 @@ jobs:
|
|||
tag: ${{ env.PKG_VERSION }}
|
||||
name: ${{ env.PKG_VERSION }}
|
||||
body: ${{ steps.covprocess.outputs.changelog }}
|
||||
artifacts: "/home/runner/work/release/release.tar.gz,coverage.json"
|
||||
artifacts: "/home/runner/work/release/release.tar.gz,coverage.json,historical-coverage.json"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
|
|
|
@ -10,12 +10,14 @@ const dec = new TextDecoder()
|
|||
|
||||
async function main () {
|
||||
const token = core.getInput('token')
|
||||
const tokenCommon = core.getInput('tokenCommon')
|
||||
const inputCovPath = core.getInput('coverageResultsPath') // 'data/coverage-raw.json'
|
||||
const outputCovPath = core.getInput('coverageResultsPath') // 'data/coverage.json'
|
||||
const outputHistPath = core.getInput('histCoveragePath') // 'data/historical-coverage.json'
|
||||
const relVersionRaw = core.getInput('version') // 'v7.47.0'
|
||||
const relVersion = relVersionRaw.indexOf('v') === 0 ? relVersionRaw.substring(1) : relVersionRaw
|
||||
const gh = github.getOctokit(token)
|
||||
const ghCommon = github.getOctokit(tokenCommon)
|
||||
const owner = github.context.repo.owner // 'ietf-tools'
|
||||
const repo = github.context.repo.repo // 'datatracker'
|
||||
const sender = github.context.payload.sender.login // 'rjsparks'
|
||||
|
@ -58,7 +60,6 @@ async function main () {
|
|||
releases.push(...resp.data)
|
||||
}
|
||||
} while (hasMoreReleases)
|
||||
console.info(releases[0])
|
||||
console.info(`Found ${releases.length} existing releases.`)
|
||||
|
||||
// -> Fetch latest historical coverage
|
||||
|
@ -95,7 +96,7 @@ async function main () {
|
|||
}
|
||||
|
||||
// -> Find matching release version
|
||||
const newRelease = find(releases, ['name', 'v7.46.0']) // relVersionRaw
|
||||
const newRelease = find(releases, ['name', relVersionRaw])
|
||||
if (!newRelease) {
|
||||
console.warn(`Could not find a release matching ${relVersionRaw}... Skipping coverage chart generation...`)
|
||||
return
|
||||
|
@ -126,7 +127,7 @@ async function main () {
|
|||
const datasetCode = []
|
||||
const datasetTemplate = []
|
||||
const datasetUrl = []
|
||||
for (const [key, value] of Object.entries(covData)) {
|
||||
for (const [key, value] of Object.entries(covData).sort((a, b) => a[0].localeCompare(b[0]))) {
|
||||
labels.push(key)
|
||||
datasetCode.push(round(value.code * 100, 2))
|
||||
datasetTemplate.push(round(value.template * 100, 2))
|
||||
|
@ -212,7 +213,7 @@ async function main () {
|
|||
const svg = Buffer.from(outputStream).toString('base64')
|
||||
|
||||
console.info(`Uploading chart SVG for ${newRelease.name}...`)
|
||||
await gh.rest.repos.createOrUpdateFileContents({
|
||||
await ghCommon.rest.repos.createOrUpdateFileContents({
|
||||
owner,
|
||||
repo: repoCommon,
|
||||
path: `assets/graphs/datatracker/${newRelease.id}.svg`,
|
||||
|
@ -240,7 +241,7 @@ async function main () {
|
|||
formattedBody += `}?style=flat-square)\n\n`
|
||||
formattedBody += ``
|
||||
|
||||
core.exportVariable('changelog', formattedBody)
|
||||
core.setOutput('changelog', formattedBody)
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue