Skip to content

Commit ea39f31

Browse files
committed
wip
1 parent e5ea5fc commit ea39f31

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/validate.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
on:
3+
pull_request:
4+
types: [labeled]
5+
6+
permissions:
7+
pull-requests: write
8+
9+
# Ensures that multiple validation job runs do not execute concurrently on the same PR.
10+
# If a new run is triggered, any in-progress run for the same group is canceled.
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
16+
jobs:
17+
multiple-labels:
18+
name: 'Check that only one validation label is applied'
19+
if: >
20+
(contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-full-validation-long')) ||
21+
(contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation')) ||
22+
(contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation'))
23+
runs-on: ubuntu-latest
24+
steps:
25+
- env:
26+
GH_TOKEN: ${{ secrets.GH_PAT }}
27+
run: |
28+
echo "Multiple validation labels detected. Removing labels..."
29+
30+
# Remove appropriate labels based on which ones are present
31+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') }}" == "true" ]]; then
32+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation-long"
33+
fi
34+
35+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation') }}" == "true" ]]; then
36+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation"
37+
fi
38+
39+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-quick-validation') }}" == "true" ]]; then
40+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-quick-validation"
41+
fi
42+
43+
echo "Completed label cleanup"
44+
exit 1
45+
46+
47+
validate:
48+
name: 'Validate Changed Packages - Github Hosted'
49+
runs-on: ubuntu-latest
50+
# if: >
51+
# contains(github.event.pull_request.labels.*.name, 'run-full-validation') &&
52+
# !contains(github.event.pull_request.labels.*.name, 'run-full-validation-long')
53+
if: >
54+
contains(github.event.pull_request.labels.*.name, 'run-full-validation') ||
55+
contains(github.event.pull_request.labels.*.name, 'run-quick-validation')
56+
steps:
57+
58+
- name: Run Validation Script
59+
run: |
60+
echo "Running validation because 'full validation' label was added"
61+
# Add your validation logic here (e.g., linting, testing)
62+
63+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-quick-validation') }}" == "true" ]]; then
64+
# Perform validation in 'Individual" mode
65+
echo "Running Quick Validation..."
66+
else
67+
Perform validation in 'Thorough' mode
68+
echo "Running Full Validation..."
69+
fi
70+
71+
sleep 5
72+
exit 0
73+
74+

0 commit comments

Comments
 (0)