@@ -12,36 +12,57 @@ jobs:
1212 - name : Checkout code
1313 uses : actions/checkout@v3
1414
15- - name : Get PR Labels
16- id : get-labels
17- uses : actions/github-script@v6
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
1850 with :
19- script : |
20- const labels = context.payload.pull_request.labels.map(label => label.name);
21- return labels;
22- result-encoding : string
51+ script : |
52+ const labels = context.payload.pull_request.labels.map(label => label.name);
53+ const hasQuickValidation = labels.includes('quick validation');
54+ const hasFullValidation = labels.includes('full validation');
55+
56+ let validationMode = 'thorough';
57+
58+ if (hasQuickValidation && !hasFullValidation) {
59+ validationMode = 'individual';
60+ }
61+
62+ console.log(`SFP Validation Mode: ${validationMode}`);
63+ return validationMode;
64+ result-encoding : string
2365
24- - name : Determine Validation Type
25- id : determine-validation
66+ - name : Run Commands Based on the Validation Mode
2667 run : |
27- labels="${{ steps.get-labels.outputs.result }}"
28- echo "PR Labels: $labels"
29-
30- if echo "$labels" | grep -q "full validation"; then
31- echo "validation_type=full" >> $GITHUB_OUTPUT
32- elif echo "$labels" | grep -q "quick validation"; then
33- echo "validation_type=quick" >> $GITHUB_OUTPUT
34- else
35- echo "No specific validation label found. Defaulting to full validation."
36- echo "validation_type=full" >> $GITHUB_OUTPUT
37- fi
38-
39- cat $GITHUB_OUTPUT
40-
41- - name : Run Full Validation
42- if : ${{ steps.determine-validation.outputs.validation_type == 'full' }}
43- run : echo "Running Full Validation..."
44-
45- - name : Run Quick Validation
46- if : ${{ steps.determine-validation.outputs.validation_type == 'quick' }}
47- run : echo "Running Quick Validation..."
68+ echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
0 commit comments