Skip to content

Commit d2ec455

Browse files
szymon-czaprackisjanc
authored andcommitted
ci: Skip style-check workflow if label is present
This update adds a label-based conditional to the compliance_check.yml GitHub Actions workflow. If a pull request includes the label `skip-style-check`, the style check step will be skipped. This allows maintainers to bypass formatting validation in exceptional cases, such as bulk updates or style-irrelevant changes.
1 parent dedfaf5 commit d2ec455

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/compliance_check.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
name: Compliance check
2121

22-
on: [pull_request]
22+
on:
23+
pull_request:
24+
types: [opened, synchronize, reopened, labeled, unlabeled]
2325

2426
jobs:
2527
style_check:
@@ -33,7 +35,23 @@ jobs:
3335
shell: bash
3436
run: |
3537
python -m pip install clang-format
38+
39+
- name: Check label
40+
id: label_check
41+
uses: actions/github-script@v7
42+
with:
43+
script: |
44+
const labelName = 'skip-style-check';
45+
const labels = await github.rest.issues.listLabelsOnIssue({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: context.payload.pull_request.number,
49+
});
50+
const hasLabel = labels.data.some(label => label.name === labelName);
51+
core.setOutput('skip', hasLabel);
52+
3653
- name: check style
54+
if: steps.label_check.outputs.skip != 'true'
3755
shell: bash
3856
run: |
3957
set +e

0 commit comments

Comments
 (0)