Skip to content

ci(label): trigger workflows on labelling #32

ci(label): trigger workflows on labelling

ci(label): trigger workflows on labelling #32

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:
github-token: "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"
script: |
const [owner, repo] = ["gear-tech", "gear"];
let { ref, payload: { number: issue_number }, sha } = context;
console.log(ref);
const ref = "cl/issue-2888";
const issue_number = 3070;
const sha = "e106703d287e1ede7dd718d5a88dabd993a059e2";
// 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,
});
console.log(check_runs);
for (run of check_runs) {
if (run.conclusion !== "skipped") continue;
if (linux && run.name === "build") {
// const linuxCheck = await github.rest.checks.create({
// owner,
// repo,
// name: "a-new-check",
// head_sha: sha,
//
// });
//
// console.log(linuxCheck);
// const winCheck = await github.rest.checks.create({
// owner,
// repo,
// name: "build / win-cross",
// head_sha: sha
// });
//
// console.log(winCheck);
}
// if (
// (linux && run.name === "build") ||
// (macos && run.name === "build / macos-x86")
// ) {
// await github.rest.checks.create({
// owner,
// repo,
// });
//
// break;
// }
}