Skip to content

Commit

Permalink
ci(label): share outputs between steps
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Aug 16, 2023
1 parent d9c2ddc commit 2b27255
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ concurrency:
cancel-in-progress: true

jobs:
check:
status:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.label-checks.outputs.build }}
linux: ${{ steps.label-checks.outputs.linux }}
win: ${{ steps.label-checks.outputs.win }}
macos: ${{ steps.label-checks.outputs.macos }}
steps:
- uses: actions/github-script@v6
id: label-checks
with:
script: |
const [owner, repo] = ["gear-tech", "gear"];
const { ref, payload: { issue: issue_number } } = context;
console.log(JSON.stringify(context.payload));
// const ref = "cl/issue-2888";
// const issue_number = "3070"
// List all labels of the current pull request.
const { data: labelsArr } = await github.rest.issues.listLabelsOnIssue({
Expand All @@ -44,20 +52,25 @@ jobs:
ref,
});
for (const run in check_runs) {
if (run.name == "build) {
linux = (run.conclusion == "skipped");
for (run in check_runs) {
if (run.name === "build") {
linux = (run.conclusion === "skipped");
} else if (run.name == "build / macos") {
macos = (run.conclusion == "skipped");
macos = (run.conclusion === "skipped");
}
}
const build = linux || macos;
return { build, linux, win: linux, macos }
const outputs = { build, linux, win: linux, macos };
console.log(outputs);
return outputs;
- uses: ./.github/workflows/build.yml
if: ${{ steps.label-checks.outputs.result.build }}
with:
linux: ${{ steps.label-checks.outputs.result.linux }}
win: ${{ steps.label-checks.outputs.result.win }}
macos: ${{ steps.label-checks.outputs.result.macos }}
build:
needs: status
uses: ./.github/workflows/build.yml
if: ${{ needs.status.outputs.build }}
with:
cache: true
linux: ${{ needs.status.outputs.linux }}
win: ${{ needs.status.outputs.win }}
macos: ${{ needs.status.outputs.macos }}

0 comments on commit 2b27255

Please sign in to comment.