Skip to content

Commit 452052c

Browse files
committed
fix?
1 parent dad1389 commit 452052c

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

.github/workflows/label-triggers.yml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,37 @@ jobs:
2929
body: '@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!'
3030
})
3131
32-
re_dispatch_benchmarks:
33-
runs-on: ubuntu-latest
34-
if: >
35-
github.event.label.name == 'skip-validate-benchmarks' ||
36-
github.event.label.name == 'skip-validate-benchmarks' && github.event.action == 'labeled' ||
37-
github.event.label.name == 'skip-validate-benchmarks' && github.event.action == 'unlabeled'
38-
steps:
39-
- name: Re-dispatch Validate-Benchmarks
40-
uses: actions/github-script@v6
41-
with:
42-
script: |
43-
await github.rest.actions.createWorkflowDispatch({
44-
owner: context.repo.owner,
45-
repo: context.repo.repo,
46-
workflow_id: 'run-benchmarks.yml',
47-
ref: context.payload.pull_request.head.ref
48-
})
32+
dispatch_benchmarks:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Determine skip flag
37+
id: skip-check
38+
uses: actions/github-script@v6
39+
with:
40+
script: |
41+
const pr = context.payload.pull_request.number;
42+
const labels = (await github.rest.issues.listLabelsOnIssue({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
issue_number: pr
46+
})).data.map(l => l.name);
47+
const skip = labels.includes('skip-validate-benchmarks') ? 'true' : 'false';
48+
core.setOutput('skip', skip);
49+
50+
- name: Dispatch Validate-Benchmarks
51+
uses: actions/github-script@v6
52+
with:
53+
script: |
54+
const pr = context.payload.pull_request.number;
55+
const skip = '${{ steps.skip-check.outputs.skip }}';
56+
await github.rest.actions.createWorkflowDispatch({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
workflow_id: 'run-benchmarks.yml',
60+
ref: context.payload.pull_request.head.ref,
61+
inputs: {
62+
pr_number: pr.toString(),
63+
skip
64+
}
65+
});

0 commit comments

Comments
 (0)