Skip to content

Commit 95650bd

Browse files
authored
Refactor CI for forked repositories - Enhance (yoanm#125)
1 parent 5874dc4 commit 95650bd

40 files changed

+986
-214
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

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

Lines changed: 2 additions & 2 deletions
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const core = require("@actions/core"); // @TODO move to 'imports from' when moved to TS !
22

3-
if (!!core.getState('check-run-id')) {
3+
if (!!core.getState('has-been-triggered')) {
44
require('./src/cleanup');
55
} else {
66
require('./src/main');

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ async function run() {
3131
core.debug('API params=' + JSON.stringify(requestParams));
3232

3333
const apiResponse = await core.group('Conclude check-run ', async () => {
34+
/** @type {OctokitInterface} */
3435
const octokit = github.getOctokit(githubToken);
3536

3637
// @TODO Move back to `octokit.rest.checks.update()`
@@ -39,4 +40,5 @@ async function run() {
3940
core.debug('API call to ' +apiResponse.url + ' => HTTP ' + apiResponse.status);
4041
}
4142

43+
// No need to wrap cleanup with try/catch, error are ignored anyway
4244
run();

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ const ghaHelpers = require('../node-gha-helpers');
66
const formatMarkdownUrl = (title, link) => '<a href="' + link + '" target="blank">' + title + '</a>';
77

88
async function run() {
9+
core.saveState('has-been-triggered', 1);
910
/** INPUTS **/
1011
const githubToken = core.getInput('github-token', {required: true});
1112
const jobStatus = core.getInput('job-status', {required: true});
1213
const checkName = core.getInput('name');
1314
const failsOnTriggeringWorkflowFailure = core.getBooleanInput('fails-on-triggering-workflow-failure', {required: true});
1415

1516
const isSuccessfulJobAsOfNow = 'success' === jobStatus;
16-
const octokit = getOctokit(githubToken);
17+
const octokit = /** @type {OctokitInterface} */getOctokit(githubToken);
1718

1819
const requestParams = await core.group(
1920
'Build API params',
@@ -70,4 +71,7 @@ async function run() {
7071
}
7172
}
7273

73-
run();
74+
run().catch(e => {
75+
core.warning('Error caught and ignored ' + e.message);
76+
core.debug('Error=' + JSON.stringify(e));
77+
});

.github/actions/reports-group/create-action/dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/reports-group/create-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/create-action/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ async function run() {
116116
return res;
117117
}
118118
);
119-
core.debug('outputs=' + JSON.stringify(outputs));
120119
SDK.outputs.bindFrom(outputs);
121120
}
122121

.github/actions/reports-group/fetch-workflow-metadata-action/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: TODO
44
inputs:
55
from-triggering-workflow:
66
description: |
7-
Weither to look for triggering workflow context or just current workflow context (default `true` !).
7+
Whether to look for triggering workflow context or just current workflow context (default `true` !).
88
- True: In case current workflow event is `workflow_run`, the context of the workflow which **triggered** the current one will be returned. Else returns the current workflow context
99
- False: Return the context for the current workflow.
1010
required: false

0 commit comments

Comments
 (0)