Skip to content

Commit cc7fc41

Browse files
committed
Use the action
1 parent 826a6dd commit cc7fc41

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

.github/actions/reports-group/attach-check-run-to-triggering-workflow-action/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ description: |
33
Create a reports group directory under provided `path`, with a metada file and a copy of all `files`
44
Reports are expected to share the same format !
55
inputs:
6-
head-sha:
7-
description: TODO
6+
name:
7+
description: Status check name
8+
required: true
9+
commit-sha:
10+
description: Commit SHA to attach to the check
811
required: true
912
github-token:
10-
description: TODO
13+
description: Github Authentication token used to create the check through GitHub API
1114
required: true
12-
name:
13-
description: Status check name
14-
required: false
1515
status:
1616
description: Status check status
1717
required: false

.github/actions/reports-group/attach-check-run-to-triggering-workflow-action/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/reports-group/attach-check-run-to-triggering-workflow-action/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/reports-group/attach-check-run-to-triggering-workflow-action/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ async function run() {
55
const {GITHUB_REPOSITORY: repository} = process.env;
66
const [repoOwner, repoName] = repository.split('/');
77
/** INPUTS **/
8+
const commitSha = core.getInput('commit-sha', {required: true});
89
const checkName = core.getInput('name', {required: true});
9-
const headSha = core.getInput('head-sha', {required: true});
10+
const githubToken = core.getInput('github-token', {required: true});
1011

1112
// Following inputs are not required and may not have any value attached !
1213
const checkStatus = core.getInput('status');
@@ -23,7 +24,7 @@ async function run() {
2324
async () => {
2425
const res = {
2526
name: checkName,
26-
head_sha: headSha,
27+
head_sha: commitSha,
2728
details_url: undefinedIfEmpty(detailsUrl),
2829
external_id: undefinedIfEmpty(externalId),
2930
status: undefinedIfEmpty(checkStatus),
@@ -41,7 +42,7 @@ async function run() {
4142
);
4243

4344
const { data: checkRun } = await core.group('Call API', async () => {
44-
const octokit = github.getOctokit(core.getInput('github-token', {required: true}));
45+
const octokit = github.getOctokit(githubToken);
4546

4647
return octokit.rest.checks.create(requestParams);
4748
});

.github/workflows/codacy-upload-from-artifacts.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
# @TODO Investigate: `workflow_run` don't create a status check on the related PR !
2828
# Would it be handy/secure/not to complex to create a reports-group/check-run-from-workflow-run which:
2929
# - Would need to be added as first workflow wtep in order to create a `in-progress` check-run with all info fetched from the triggering workflow
30-
# - Add a `fail-if-caller-failed` option which would create `failed` check-run and exit with an error ?
30+
# - Add a `fails-on-caller-failure` option which would create `failed` check-run and exit with an error ? (a bit more handy than end-user having to check it)
3131
# - Would update the check-run during post-process with the current status of the triggered workflow
3232
jobs:
3333
upload:
@@ -37,11 +37,18 @@ jobs:
3737
groups: ${{ steps.upload.outputs.groups }}
3838
reports: ${{ steps.upload.outputs.reports }}
3939
steps:
40-
# @TODO move reports-group/codacy-uploader action to a dedicated repo and remove the checkout
40+
# @TODO move actions to a dedicated repo and remove the checkout
4141
- uses: actions/checkout@v4
4242
with:
4343
path: custom-action-repo
4444

45+
- uses: ./custom-action-repo/.github/actions/reports-group/attach-check-run-to-triggering-workflow-action
46+
with:
47+
name: "${{ github.workflow }} (${{ github.event.workflow.name}}) / Codacy / Upload all reports"
48+
commit-sha: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.event.workflow_run.event || 'push' == github.event.workflow_run.event) && github.event.workflow_run.head_sha) || ('pull_request' == github.event_name && github.event.pull_request.head.sha) || ('push' == github.event_name && github.sha) || null }}"
49+
github-token: ${{ github.token }}
50+
status: queued
51+
4552
- name: Download artifacts
4653
uses: actions/download-artifact@v4
4754
with:

.github/workflows/codecov-upload-from-artifacts.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ jobs:
3434
with:
3535
path: custom-action-repo
3636

37+
- uses: ./custom-action-repo/.github/actions/reports-group/attach-check-run-to-triggering-workflow-action
38+
with:
39+
name: "${{ github.workflow }} (${{ github.event.workflow.name}}) / Codecov / Prepare"
40+
commit-sha: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.event.workflow_run.event || 'push' == github.event.workflow_run.event) && github.event.workflow_run.head_sha) || ('pull_request' == github.event_name && github.event.pull_request.head.sha) || ('push' == github.event_name && github.sha) || null }}"
41+
github-token: ${{ github.token }}
42+
status: queued
43+
3744
- name: Download artifacts
3845
uses: actions/download-artifact@v4
3946
with:
@@ -106,6 +113,13 @@ jobs:
106113
- name: Checkout Repository
107114
uses: actions/checkout@v4
108115

116+
- uses: ./custom-action-repo/.github/actions/reports-group/attach-check-run-to-triggering-workflow-action
117+
with:
118+
name: "${{ github.workflow }} (${{ github.event.workflow.name}}) / Codecov / ${{ matrix.artifact}} - ${{ matrix.path }}"
119+
commit-sha: "${{ ('workflow_run' == github.event_name && ('pull_request' == github.event.workflow_run.event || 'push' == github.event.workflow_run.event) && github.event.workflow_run.head_sha) || ('pull_request' == github.event_name && github.event.pull_request.head.sha) || ('push' == github.event_name && github.sha) || null }}"
120+
github-token: ${{ github.token }}
121+
status: queued
122+
109123
- name: Download '${{ matrix.artifact }}' artifact
110124
uses: actions/download-artifact@v4
111125
with:

0 commit comments

Comments
 (0)