Skip to content

Commit bc27c3b

Browse files
committed
chore: synced local './' with remote 'sync-files/anemoi/all/'
Triggered from common files on https://github.com/ecmwf/reusable-workflows
1 parent 2c72b95 commit bc27c3b

File tree

2 files changed

+68
-2
lines changed

2 files changed

+68
-2
lines changed

.github/workflows/pr-label-ats.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow checks that the appropriate ATS labels are applied to a pull request:
2+
# - "ATS Approval Not Needed": pass
3+
# - "ATS Approved": pass
4+
# - "ATS Approval Needed": fail
5+
# - Missing ATS label: fail
6+
7+
name: "[PR] ATS labels"
8+
9+
on:
10+
pull_request:
11+
types:
12+
- opened
13+
- edited
14+
- reopened
15+
- labeled
16+
- unlabeled
17+
- synchronize
18+
19+
permissions:
20+
pull-requests: read
21+
22+
jobs:
23+
check:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Get PR details
27+
uses: actions/github-script@v7
28+
id: check-pr
29+
with:
30+
script: |
31+
const pr = await github.rest.pulls.get({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
pull_number: context.payload.pull_request.number,
35+
});
36+
const labels = pr.data.labels.map(label => label.name);
37+
core.setOutput('labels', JSON.stringify(labels));
38+
core.setOutput('author', context.payload.pull_request.user.login);
39+
40+
- name: Evaluate ATS labels
41+
run: |
42+
AUTHOR='${{ steps.check-pr.outputs.author }}'
43+
if [ "$AUTHOR" == "DeployDuck" ] || [ "$AUTHOR" == "pre-commit-ci[bot]" ]; then
44+
echo "Bot PR, skipping."
45+
exit 0
46+
fi
47+
LABELS=$(echo '${{ steps.check-pr.outputs.labels }}' | jq -r '.[]')
48+
echo "Labels found:"
49+
echo -e "$LABELS\n"
50+
echo "Result:"
51+
if echo "$LABELS" | grep -qi "ATS approval not needed"; then
52+
echo "ATS approval not needed. Passing."
53+
EXIT_CODE=0
54+
elif echo "$LABELS" | grep -qi "ATS approved"; then
55+
echo "ATS Approved. Passing."
56+
EXIT_CODE=0
57+
elif echo "$LABELS" | grep -qi "ATS approval needed"; then
58+
echo "ATS Approval Needed. Failing."
59+
EXIT_CODE=1
60+
else
61+
echo "No ATS approval labels found. Please assign the appropriate ATS label. Failing."
62+
EXIT_CODE=1
63+
fi
64+
echo -e "\nFor more information on ATS labels, see:"
65+
echo "https://anemoi.readthedocs.io/en/latest/contributing/guidelines.html#labelling-guidelines"
66+
exit $EXIT_CODE

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
1111
additional_dependencies: [jupyter]
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v5.0.0
13+
rev: v6.0.0
1414
hooks:
1515
- id: check-yaml # Check YAML files for syntax errors only
1616
args: [--unsafe, --allow-multiple-documents]
@@ -41,7 +41,7 @@ repos:
4141
- --profile black
4242
- --project anemoi
4343
- repo: https://github.com/astral-sh/ruff-pre-commit
44-
rev: v0.12.7
44+
rev: v0.12.11
4545
hooks:
4646
- id: ruff
4747
args:

0 commit comments

Comments
 (0)