Skip to content

Validate-Benchmarks action respects label better #1896

Validate-Benchmarks action respects label better

Validate-Benchmarks action respects label better #1896

Workflow file for this run

name: Label Triggers
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
- opened
permissions:
issues: write
pull-requests: write
actions: write
jobs:
comment_on_breaking_change:
runs-on: ubuntu-latest
steps:
- name: Check if 'breaking change' label is added
if: github.event.label.name == 'breaking-change'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!'
})
dispatch_benchmarks:
runs-on: ubuntu-latest
steps:
- name: Determine skip flag
id: skip-check
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request.number;
const labels = (await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr
})).data.map(l => l.name);
const skip = labels.includes('skip-validate-benchmarks') ? 'true' : 'false';
core.setOutput('skip', skip);
- name: Dispatch Validate-Benchmarks
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request.number;
const skip = '${{ steps.skip-check.outputs.skip }}';
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'run-benchmarks.yml',
ref: context.payload.pull_request.head.ref,
inputs: {
pr_number: pr.toString(),
skip
}
});