1+
2+ on :
3+ pull_request :
4+ types : [synchronize, opened, reopened, labeled]
5+
6+ permissions :
7+ pull-requests : write
8+
9+ jobs :
10+ multiple-labels :
11+ name : ' Check that only one validation label is applied'
12+ if : >
13+ (contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-full-validation-long')) ||
14+ (contains(github.event.pull_request.labels.*.name, 'run-full-validation') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation')) ||
15+ (contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') && contains(github.event.pull_request.labels.*.name, 'run-quick-validation'))
16+ runs-on : ubuntu-latest
17+ steps :
18+ - env :
19+ GH_TOKEN : ${{ secrets.GH_PAT }}
20+ run : |
21+ echo "Multiple validation labels detected. Removing extra labels..."
22+ #gma gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation-long" --remove-label "run-full-validation" --remove-label "validation"
23+
24+ # Remove appropriate labels based on which ones are present
25+ if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation-long') }}" == "true" ]]; then
26+ gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation-long"
27+ fi
28+
29+ if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-full-validation') }}" == "true" ]]; then
30+ gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "run-full-validation"
31+ fi
32+
33+ if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-quick-validation') }}" == "true" ]]; then
34+ gh pr edit ${{ github.event.pull_request.number }} --repo $GITHUB_REPOSITORY --remove-label "validation"
35+ fi
36+
37+ echo "Completed label cleanup"
38+
39+
40+ validate :
41+ name : ' Validate Changed Packages - Github Hosted'
42+ runs-on : ubuntu-latest
43+
44+ steps :
45+
46+ - name : Run Validation Script
47+ run : |
48+ echo "Running validation because 'full validation' label was added"
49+ # Add your validation logic here (e.g., linting, testing)
50+
51+ sleep 5
52+ exit 0
53+
54+
0 commit comments