Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 3, 2022
1 parent 63c2f8a commit 2d7e909
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
steps:
# workflowの結果を取得するためにこのアクションを実行
# 環境変数から結果を取得できます (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v2
- uses: technote-space/workflow-conclusion-action@v3

# workflowの結果を使用してアクションを実行
- uses: 8398a7/action-slack@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
steps:
# run this action to get the workflow conclusion
# You can get the conclusion via env (env.WORKFLOW_CONCLUSION)
- uses: technote-space/workflow-conclusion-action@v2
- uses: technote-space/workflow-conclusion-action@v3

# run other action with the workflow conclusion
- uses: 8398a7/action-slack@v3
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
description: Fallback conclusion
required: false
default: skipped
STRICT_SUCCESS:
description: Whether to report as success only if all jobs are successful
required: false
default: "false"

outputs:
conclusion:
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"technote-space","repo":"workflow-conclusion-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v2.2.3","branch":"gh-actions","tags":["test/v2.2.3","test/v2.2","test/v2"],"updated_at":"2022-06-01T17:53:50.537Z"}
{"owner":"technote-space","repo":"workflow-conclusion-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v2.2.3","branch":"gh-actions","tags":["test/v2.2.3","test/v2.2","test/v2"],"updated_at":"2022-06-03T12:51:30.935Z"}
13 changes: 7 additions & 6 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87913,12 +87913,13 @@ const getJobs = async (octokit, context) => octokit.paginate(octokit.rest.action
...context.repo,
'run_id': getTargetRunId(context),
});
const getJobConclusions = (jobs) => utils.uniqueArray(Object.values(jobs
.filter(job => null !== job.conclusion)
.map(job => ({ name: job.name, conclusion: String(job.conclusion) }))
.reduce((acc, job) => ({ ...acc, [job.name]: job.conclusion }), {})));
// eslint-disable-next-line no-magic-numbers
const getWorkflowConclusion = (conclusions) => CONCLUSIONS.filter(conclusion => conclusions.includes(conclusion)).slice(-1)[0] ?? coreExports.getInput('FALLBACK_CONCLUSION');
const getJobConclusions = (jobs) => utils.uniqueArray(jobs
.filter((job) => null !== job.conclusion)
.map(job => job.conclusion));
const getWorkflowConclusion = (conclusions) => !conclusions.length ? coreExports.getInput('FALLBACK_CONCLUSION') :
utils.getBoolValue(coreExports.getInput('STRICT_SUCCESS')) ?
conclusions.some(conclusion => conclusion !== 'success') ? 'failure' : 'success' :
CONCLUSIONS.filter(conclusion => conclusions.includes(conclusion)).slice(-1)[0] ?? coreExports.getInput('FALLBACK_CONCLUSION');
const execute = async (logger, octokit, context) => {
const jobs = await getJobs(octokit, context);
const conclusions = getJobConclusions(jobs);
Expand Down

0 comments on commit 2d7e909

Please sign in to comment.