Skip to content

Commit f36576d

Browse files
committed
wip
1 parent a3c7bf9 commit f36576d

1 file changed

Lines changed: 21 additions & 74 deletions

File tree

.github/workflows/validate.yaml

Lines changed: 21 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,39 @@
1-
name: Validate and Run Commands Based on PR Labels
2-
1+
name: PR Validation
32
on:
43
pull_request:
54
types: [opened, synchronize, labeled, unlabeled]
65
branches:
76
- main
87

98
jobs:
10-
validate-and-execute:
9+
check-full-validation:
1110
runs-on: ubuntu-latest
12-
1311
steps:
14-
15-
- name: Check Last Nightly Run
16-
id: check-last-nightly-run
17-
uses: actions/github-script@v7
12+
- name: Check Full Validation Status
13+
uses: actions/github-script@v6
1814
with:
19-
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
github-token: ${{secrets.GITHUB_TOKEN}}
2016
script: |
21-
const { owner, repo } = context.repo;
22-
const runs = await github.rest.actions.listWorkflowRuns({
23-
owner,
24-
repo,
25-
workflow_id: 'nightly.yaml',
26-
branch: 'main',
27-
status: 'completed'
17+
const { data: statuses } = await github.rest.repos.listCommitStatusesForRef({
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
ref: 'main'
2821
});
29-
if (runs.data.workflow_runs.length === 0) {
30-
core.setFailed('No successful nightly runs found.');
31-
} else if (runs.data.workflow_runs[0].conclusion !== 'success') {
32-
core.setFailed(`Last nightly run failed. See: ${runs.data.workflow_runs[0].html_url}`);
22+
23+
const latestFullValidation = statuses.find(status => status.context === 'nightly-full-validation');
24+
25+
if (!latestFullValidation || latestFullValidation.state !== 'success') {
26+
core.setFailed('Latest full validation was not successful');
3327
}
3428
29+
quick-validation:
30+
needs: check-full-validation
31+
runs-on: ubuntu-latest
32+
steps:
3533
- name: Checkout code
3634
uses: actions/checkout@v3
3735

38-
# - name: Get PR Labels
39-
# id: get-labels
40-
# uses: actions/github-script@v6
41-
# with:
42-
# script: |
43-
# const labels = context.payload.pull_request.labels.map(label => label.name);
44-
# return labels;
45-
# result-encoding: string
46-
47-
# - name: Determine Validation Type
48-
# id: determine-validation-mode
49-
# run: |
50-
# labels="${{ steps.get-labels.outputs.result }}"
51-
52-
# validation_mode="thorough"
53-
# if echo "$labels" | grep -q "quick validation"; then
54-
# validation_mode="individual"
55-
# fi
56-
57-
# echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT
58-
59-
# # Validate source and trigger test, skipping if there are no deployable changes
60-
# - name: 'If deployable changes were made, push source to a scratch org'
61-
# run: |
62-
# labels="${{ steps.get-labels.outputs.result }}"
63-
64-
# validation_mode="thorough"
65-
# if echo "$labels" | grep -q "quick validation"; then
66-
# validation_mode="individual"
67-
# fi
68-
# echo $validation_mode
69-
70-
- name: Get SFP Pool Validation Mode from the PR labels
71-
id: sfp-validation-mode
72-
uses: actions/github-script@v7
73-
with:
74-
script: |
75-
76-
const labels = context.payload.pull_request.labels.map(label => label.name);
77-
const hasQuickValidation = labels.includes('quick validation');
78-
const hasFullValidation = labels.includes('full validation');
79-
80-
let validationMode = 'thorough';
81-
82-
if (hasQuickValidation && !hasFullValidation) {
83-
validationMode = 'individual';
84-
}
85-
86-
console.log(`SFP Validation Mode: ${validationMode}`);
87-
return validationMode;
88-
result-encoding: string
89-
90-
- name: Run Commands Based on the Validation Mode
36+
- name: Run Quick Validation
9137
run: |
92-
echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
38+
echo "Running quick validation:"
39+
# Your quick validation steps here

0 commit comments

Comments
 (0)