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+ sfp- validate-pool :
99 runs-on : ubuntu-latest
10-
10+ if : >
11+ github.event.issue.pull_request &&
12+ (
13+ contains(github.event.comment.body, '/quick-validation') ||
14+ contains(github.event.comment.body, '/full-validation')
15+ )
1116 steps :
12- - name : Checkout code
17+ - name : Checkout
1318 uses : actions/checkout@v3
1419
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 : |
20+ - name : Validate
21+ run : |
22+ if [[ "${{ github.event.comment.body }}" == *"/quick-validation"* ]]; then
23+ echo "Running Quick Validation..."
24+ # Add your quick validation commands here
25+ elif [[ "${{ github.event.comment.body }}" == *"/full-validation"* ]]; then
26+ echo "Running Full Validation..."
27+ # Add your full validation commands here
28+ else
29+ echo "No matching validation type found."
30+ exit 1
31+ fi
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+ # name: Validate and Run Commands Based on PR Labels
78+
79+ # on:
80+ # pull_request:
81+ # types: [opened, synchronize, labeled, unlabeled]
82+
83+ # jobs:
84+ # validate-and-execute:
85+ # runs-on: ubuntu-latest
86+
87+ # steps:
88+ # - name: Checkout code
89+ # uses: actions/checkout@v3
90+
91+ # # - name: Get PR Labels
92+ # # id: get-labels
93+ # # uses: actions/github-script@v6
94+ # # with:
95+ # # script: |
96+ # # const labels = context.payload.pull_request.labels.map(label => label.name);
97+ # # return labels;
98+ # # result-encoding: string
99+
100+ # # - name: Determine Validation Type
101+ # # id: determine-validation-mode
102+ # # run: |
103+ # # labels="${{ steps.get-labels.outputs.result }}"
104+
105+ # # validation_mode="thorough"
106+ # # if echo "$labels" | grep -q "quick validation"; then
107+ # # validation_mode="individual"
108+ # # fi
109+
110+ # # echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT
111+
112+ # # # Validate source and trigger test, skipping if there are no deployable changes
113+ # # - name: 'If deployable changes were made, push source to a scratch org'
114+ # # run: |
115+ # # labels="${{ steps.get-labels.outputs.result }}"
116+
117+ # # validation_mode="thorough"
118+ # # if echo "$labels" | grep -q "quick validation"; then
119+ # # validation_mode="individual"
120+ # # fi
121+ # # echo $validation_mode
122+
123+ # - name: Get SFP Pool Validation Mode from the PR labels
124+ # id: sfp-validation-mode
125+ # uses: actions/github-script@v7
126+ # with:
127+ # script: |
52128
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');
129+ # const labels = context.payload.pull_request.labels.map(label => label.name);
130+ # const hasQuickValidation = labels.includes('quick validation');
131+ # const hasFullValidation = labels.includes('full validation');
56132
57- let validationMode = 'thorough';
133+ # let validationMode = 'thorough';
58134
59- if (hasQuickValidation && !hasFullValidation) {
60- validationMode = 'individual';
61- }
135+ # if (hasQuickValidation && !hasFullValidation) {
136+ # validationMode = 'individual';
137+ # }
62138
63- console.log(`SFP Validation Mode: ${validationMode}`);
64- return validationMode;
65- result-encoding : string
139+ # console.log(`SFP Validation Mode: ${validationMode}`);
140+ # return validationMode;
141+ # result-encoding: string
66142
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 }}"
143+ # - name: Run Commands Based on the Validation Mode
144+ # run: |
145+ # echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
0 commit comments