forked from gcovr/gcovr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because of credentials needed to upload to Codacy we need to add a separate workflow which is executed in the context of the target repository to see the credentials for uploading
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Upload coverage | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['Run GCOVR Ci'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: coverage-* | ||
run-id: ${{ github.event.workflow_run.id }} | ||
# github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
headers: { | ||
'Authorization': 'Bearer ' + ${{ github.token }} | ||
} | ||
}); | ||
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name.startsWith("coverage-") | ||
}); | ||
for (const artifact of matchArtifacts) { | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: artifact.id, | ||
archive_format: 'zip', | ||
headers: { | ||
'Authorization': 'Bearer ${{ secrets.github-token }}' | ||
} | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/' + artifact.id + '.zip', Buffer.from(download.data)); | ||
} | ||
- name: Unzip the artifacts | ||
run: | | ||
unzip coverage*.zip | ||
ls -alR . |