Skip to content

ci(label): trigger workflows on labelling #28

ci(label): trigger workflows on labelling

ci(label): trigger workflows on labelling #28

Workflow file for this run

name: Label
on:
pull_request:
branches: [master, vara-stage-1, vara-stage-2, vara-stage-3]
types: [labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lbuild:
runs-on: ubuntu-latest
if: github.event.label.name == 'A0-pleasereview' || github.event.label.name == 'E2-forcemacos'
steps:
- uses: actions/github-script@v6
id: label-checks
with:
script: |
const [owner, repo] = ["gear-tech", "gear"];
const { ref, payload: { number: issue_number }, sha } = context;
// 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({
owner,
repo,
issue_number,
});
const labels = labelsArr.map((label) => label.name);
let [linux, macos] = [
labels.includes("A0-pleasereview"),
labels.includes("E2-forcemacos")
];
if (!(linux || macos)) return;
// List the latest check runs
const {
data: { check_runs }
} = await github.rest.checks.listForRef({
owner,
repo,
ref,
});
for (run of check_runs) {
if (run.conclusion !== "skipped") continue;
if (linux && run.name === "build") {
await github.rest.checks.create({
owner,
repo,
name: "build / linux",
head_sha: sha
});
await github.rest.checks.create({
owner,
repo,
name: "build / win-cross",
head_sha: sha
});
}
// if (
// (linux && run.name === "build") ||
// (macos && run.name === "build / macos-x86")
// ) {
// await github.rest.checks.create({
// owner,
// repo,
// });
//
// break;
// }
}