File tree 2 files changed +36
-43
lines changed
2 files changed +36
-43
lines changed Original file line number Diff line number Diff line change 48
48
result-encoding : string
49
49
retries : 3
50
50
script : |
51
- const script = require('./.github/workflows/publish');
52
- console.log(await script({ github, context, core }));
51
+ console.log(process.cwd());
52
+ const ref = context.payload.inputs.tag;
53
+
54
+ console.log(`Checking status checks for ${ref}`);
55
+
56
+ const { owner, repo } = context.repo;
57
+ const { default_branch: branch } = context.payload.repository;
58
+
59
+ const branchData = github.rest.repos.getBranch({ owner, repo, branch });
60
+
61
+ const { data: { check_suites: checkSuites } } = await github.rest.checks.listSuitesForRef({ owner, repo, ref });
62
+
63
+ if (checkSuites.some(({ status }) => status === 'completed')) {
64
+ core.setFailed(`Some workflows for ${context.payload.inputs.tag} are still in-progress`);
65
+ }
66
+
67
+ const result = await Promise.all(
68
+ (await branchData).data.protection.required_status_checks.checks.map(({ context: check_name }) => (
69
+ github.rest.checks.listForRef({
70
+ owner,
71
+ repo,
72
+ ref,
73
+ check_name,
74
+ })
75
+ )),
76
+ );
77
+
78
+ const checkRuns = result.flatMap(({ data: { check_runs } }) => check_runs);
79
+
80
+ checkRuns.forEach(({ name, status, conclusion }) => {
81
+ if (status !== 'completed' || conclusion !== 'success') {
82
+ console.log(`${name} check failed`);
83
+ core.setFailed(`Required status check ${name} did not succeed`);
84
+ }
85
+ console.log(`${name} check passed`);
86
+ });
53
87
54
88
publish :
55
89
needs : [check-status]
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments