1- name : Validate and Run Commands Based on PR Labels
1+ name : ' PR Review Comment '
22
33on :
4- pull_request :
5- types : [opened, synchronize, labeled, unlabeled ]
4+ issue_comment :
5+ types : [created, edited ]
66
77jobs :
8- validate-and-execute :
8+ validate :
99 runs-on : ubuntu-latest
10-
10+ if : github.event.issue.pull_request && (contains(github.event.comment.body, '/quick-validation') || contains(github.event.comment.body, '/full-validation'))
1111 steps :
12- - name : Checkout code
12+ - name : Checkout
1313 uses : actions/checkout@v3
1414
15- # - name: Get PR Labels
16- # id: get-labels
17- # uses: actions/github-script@v6
18- # with:
19- # script: |
20- # const labels = context.payload.pull_request.labels.map(label => label.name);
21- # return labels;
22- # result-encoding: string
23-
24- # - name: Determine Validation Type
25- # id: determine-validation-mode
26- # run: |
27- # labels="${{ steps.get-labels.outputs.result }}"
28-
29- # validation_mode="thorough"
30- # if echo "$labels" | grep -q "quick validation"; then
31- # validation_mode="individual"
32- # fi
33-
34- # echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT
35-
36- # # Validate source and trigger test, skipping if there are no deployable changes
37- # - name: 'If deployable changes were made, push source to a scratch org'
38- # run: |
39- # labels="${{ steps.get-labels.outputs.result }}"
40-
41- # validation_mode="thorough"
42- # if echo "$labels" | grep -q "quick validation"; then
43- # validation_mode="individual"
44- # fi
45- # echo $validation_mode
46-
47- - name : Get SFP Pool Validation Mode from the PR labels
48- id : sfp-validation-mode
49- uses : actions/github-script@v7
50- with :
51- script : |
15+ - name : Validate
16+ run : |
17+ if [[ "${{ github.event.comment.body }}" == *"/quick-validation"* ]]; then
18+ echo "Running Quick Validation..."
19+ # Add your quick validation commands here
20+ elif [[ "${{ github.event.comment.body }}" == *"/full-validation"* ]]; then
21+ echo "Running Full Validation..."
22+ # Add your full validation commands here
23+ else
24+ echo "No matching validation type found."
25+ exit 1
26+ fi
27+ # name: Validate and Run Commands Based on PR Labels
28+
29+ # on:
30+ # pull_request:
31+ # types: [opened, synchronize, labeled, unlabeled]
32+
33+ # jobs:
34+ # validate-and-execute:
35+ # runs-on: ubuntu-latest
36+
37+ # steps:
38+ # - name: Checkout code
39+ # uses: actions/checkout@v3
40+
41+ # # - name: Get PR Labels
42+ # # id: get-labels
43+ # # uses: actions/github-script@v6
44+ # # with:
45+ # # script: |
46+ # # const labels = context.payload.pull_request.labels.map(label => label.name);
47+ # # return labels;
48+ # # result-encoding: string
49+
50+ # # - name: Determine Validation Type
51+ # # id: determine-validation-mode
52+ # # run: |
53+ # # labels="${{ steps.get-labels.outputs.result }}"
54+
55+ # # validation_mode="thorough"
56+ # # if echo "$labels" | grep -q "quick validation"; then
57+ # # validation_mode="individual"
58+ # # fi
59+
60+ # # echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT
61+
62+ # # # Validate source and trigger test, skipping if there are no deployable changes
63+ # # - name: 'If deployable changes were made, push source to a scratch org'
64+ # # run: |
65+ # # labels="${{ steps.get-labels.outputs.result }}"
66+
67+ # # validation_mode="thorough"
68+ # # if echo "$labels" | grep -q "quick validation"; then
69+ # # validation_mode="individual"
70+ # # fi
71+ # # echo $validation_mode
72+
73+ # - name: Get SFP Pool Validation Mode from the PR labels
74+ # id: sfp-validation-mode
75+ # uses: actions/github-script@v7
76+ # with:
77+ # script: |
5278
53- const labels = context.payload.pull_request.labels.map(label => label.name);
54- const hasQuickValidation = labels.includes('quick validation');
55- const hasFullValidation = labels.includes('full validation');
79+ # const labels = context.payload.pull_request.labels.map(label => label.name);
80+ # const hasQuickValidation = labels.includes('quick validation');
81+ # const hasFullValidation = labels.includes('full validation');
5682
57- let validationMode = 'thorough';
83+ # let validationMode = 'thorough';
5884
59- if (hasQuickValidation && !hasFullValidation) {
60- validationMode = 'individual';
61- }
85+ # if (hasQuickValidation && !hasFullValidation) {
86+ # validationMode = 'individual';
87+ # }
6288
63- console.log(`SFP Validation Mode: ${validationMode}`);
64- return validationMode;
65- result-encoding : string
89+ # console.log(`SFP Validation Mode: ${validationMode}`);
90+ # return validationMode;
91+ # result-encoding: string
6692
67- - name : Run Commands Based on the Validation Mode
68- run : |
69- echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
93+ # - name: Run Commands Based on the Validation Mode
94+ # run: |
95+ # echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
0 commit comments