Skip to content

Commit 8628323

Browse files
committed
wip
1 parent e5ea5fc commit 8628323

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/validate.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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(fromJSON('["run-full-validation", "run-full-validation-long", "run-quick-validation"]').*,
21+
github.event.pull_request.labels.*.name) > 1
22+
# if: >
23+
# (contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-full-validation-long')) ||
24+
# (contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation')) ||
25+
# (contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation'))
26+
runs-on: ubuntu-latest
27+
steps:
28+
- env:
29+
GH_TOKEN: ${{ secrets.GH_PAT }}
30+
run: |
31+
echo "Multiple validation labels detected. Removing labels..."
32+
33+
# Remove appropriate labels based on which ones are present
34+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') }}" == "true" ]]; then
35+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation-long"
36+
fi
37+
38+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation') }}" == "true" ]]; then
39+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation"
40+
fi
41+
42+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-quick-validation') }}" == "true" ]]; then
43+
gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-quick-validation"
44+
fi
45+
46+
echo "Completed label cleanup"
47+
exit 1
48+
49+
50+
validate:
51+
name: 'Validate Changed Packages - Github Hosted'
52+
runs-on: ubuntu-latest
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+
# if: >
57+
# contains(github.event.pull_request.labels.*.name, 'run-full-validation') &&
58+
# !contains(github.event.pull_request.labels.*.name, 'run-full-validation-long')
59+
60+
steps:
61+
- name: Run Validation Script
62+
run: |
63+
echo "Running validation because 'full validation' label was added"
64+
# Add your validation logic here (e.g., linting, testing)
65+
66+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-quick-validation') }}" == "true" ]]; then
67+
# Perform validation in 'Individual" mode
68+
echo "Running Quick Validation..."
69+
else
70+
Perform validation in 'Thorough' mode
71+
echo "Running Full Validation..."
72+
fi
73+
74+
sleep 5
75+
exit 0
76+
77+

0 commit comments

Comments
 (0)