1- name : Validate and Run Commands Based on PR Labels
2-
1+ name : PR Validation
32on :
43 pull_request :
54 types : [opened, synchronize, labeled, unlabeled]
5+ branches :
6+ - main
67
78jobs :
8- validate-and-execute :
9+ last-full-validation-status :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Get Last Full Validation Status
13+ uses : actions/github-script@v6
14+ with :
15+ github-token : ${{secrets.GITHUB_TOKEN}}
16+ script : |
17+ const { owner, repo } = context.repo;
18+ const runs = await github.rest.actions.listWorkflowRuns({
19+ owner,
20+ repo,
21+ workflow_id: 'nightly.yaml',
22+ branch: 'main',
23+ status: 'completed'
24+ });
25+ if (runs.data.workflow_runs.length === 0) {
26+ core.setFailed('No successful nightly runs found.');
27+ } else if (runs.data.workflow_runs[0].conclusion !== 'success') {
28+ core.setFailed(`Last nightly run failed. See: ${runs.data.workflow_runs[0].html_url}`);
29+ }
30+
31+ quick-validation :
32+ needs : last-full-validation-status
933 runs-on : ubuntu-latest
10-
1134 steps :
1235 - name : Checkout code
1336 uses : actions/checkout@v3
1437
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 : |
52-
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');
56-
57- let validationMode = 'thorough';
58-
59- if (hasQuickValidation && !hasFullValidation) {
60- validationMode = 'individual';
61- }
62-
63- console.log(`SFP Validation Mode: ${validationMode}`);
64- return validationMode;
65- result-encoding : string
66-
67- - name : Run Commands Based on the Validation Mode
38+ - name : Run Quick Validation
6839 run : |
69- echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
40+ echo "Running quick validation:"
41+ # Your quick validation steps here
0 commit comments