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+
78+
79+
80+
81+
82+ # name: Validate and Run Commands Based on PR Labels
83+
84+ # on:
85+ # pull_request:
86+ # types: [opened, synchronize, labeled, unlabeled]
87+
88+ # jobs:
89+ # validate-and-execute:
90+ # runs-on: ubuntu-latest
91+
92+ # steps:
93+ # - name: Checkout code
94+ # uses: actions/checkout@v3
95+
96+ # # - name: Get PR Labels
97+ # # id: get-labels
98+ # # uses: actions/github-script@v6
99+ # # with:
100+ # # script: |
101+ # # const labels = context.payload.pull_request.labels.map(label => label.name);
102+ # # return labels;
103+ # # result-encoding: string
104+
105+ # # - name: Determine Validation Type
106+ # # id: determine-validation-mode
107+ # # run: |
108+ # # labels="${{ steps.get-labels.outputs.result }}"
109+
110+ # # validation_mode="thorough"
111+ # # if echo "$labels" | grep -q "quick validation"; then
112+ # # validation_mode="individual"
113+ # # fi
114+
115+ # # echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT
116+
117+ # # # Validate source and trigger test, skipping if there are no deployable changes
118+ # # - name: 'If deployable changes were made, push source to a scratch org'
119+ # # run: |
120+ # # labels="${{ steps.get-labels.outputs.result }}"
121+
122+ # # validation_mode="thorough"
123+ # # if echo "$labels" | grep -q "quick validation"; then
124+ # # validation_mode="individual"
125+ # # fi
126+ # # echo $validation_mode
127+
128+ # - name: Get SFP Pool Validation Mode from the PR labels
129+ # id: sfp-validation-mode
130+ # uses: actions/github-script@v7
131+ # with:
132+ # script: |
52133
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');
134+ # const labels = context.payload.pull_request.labels.map(label => label.name);
135+ # const hasQuickValidation = labels.includes('quick validation');
136+ # const hasFullValidation = labels.includes('full validation');
56137
57- let validationMode = 'thorough';
138+ # let validationMode = 'thorough';
58139
59- if (hasQuickValidation && !hasFullValidation) {
60- validationMode = 'individual';
61- }
140+ # if (hasQuickValidation && !hasFullValidation) {
141+ # validationMode = 'individual';
142+ # }
62143
63- console.log(`SFP Validation Mode: ${validationMode}`);
64- return validationMode;
65- result-encoding : string
144+ # console.log(`SFP Validation Mode: ${validationMode}`);
145+ # return validationMode;
146+ # result-encoding: string
66147
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 }}"
148+ # - name: Run Commands Based on the Validation Mode
149+ # run: |
150+ # echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
0 commit comments