Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 48 additions & 24 deletions .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,58 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Get PR Labels
id: get-labels
uses: snnaplab/get-labels-action@v1.0.1
# - name: Get PR Labels
# id: get-labels
# uses: actions/github-script@v6
# with:
# script: |
# const labels = context.payload.pull_request.labels.map(label => label.name);
# return labels;
# result-encoding: string

- name: Check Labels and Extract Mode
id: check-labels
run: |
validation_mode_labels=$(echo '${{ env.LABELS }}' | jq -r '.[] | select(startswith("sfp_validation_mode:"))' | jq -R -s -c 'split("\n")[:-1]')
# - name: Determine Validation Type
# id: determine-validation-mode
# run: |
# labels="${{ steps.get-labels.outputs.result }}"

validation_modes=$(echo $validation_mode_labels | jq -r '.[] | split(":")[1]')
validation_mode_count=$(echo "$validation_modes" | wc -w)
# validation_mode="thorough"
# if echo "$labels" | grep -q "quick validation"; then
# validation_mode="individual"
# fi

if [ $validation_mode_count -eq 0 ]; then
echo "No 'sfp_validation_mode' label found. Failing pipeline."
exit 1
elif [ $validation_mode_count -gt 1 ]; then
echo "Multiple 'sfp_validation_mode' labels found. Only one is allowed. Failing pipeline."
exit 1
fi
# echo "validation_mode=$validation_mode" | tee -a $GITHUB_OUTPUT

echo "Validation Mode: $validation_modes"
echo "validation_mode=$validation_modes" >> $GITHUB_OUTPUT
shell: bash
# # Validate source and trigger test, skipping if there are no deployable changes
# - name: 'If deployable changes were made, push source to a scratch org'
# run: |
# labels="${{ steps.get-labels.outputs.result }}"

- name: Run Commands Based on Labels
run: |
echo "Running commands based on PR labels..."
# validation_mode="thorough"
# if echo "$labels" | grep -q "quick validation"; then
# validation_mode="individual"
# fi
# echo $validation_mode

- name: Get SFP Pool Validation Mode from the PR labels
id: sfp-validation-mode
uses: actions/github-script@v7
with:
script: |

const labels = context.payload.pull_request.labels.map(label => label.name);
const hasQuickValidation = labels.includes('quick validation');
const hasFullValidation = labels.includes('full validation');

echo "Validation mode: ${{ steps.check-labels.outputs.validation_mode }}"
let validationMode = 'thorough';

shell: bash
if (hasQuickValidation && !hasFullValidation) {
validationMode = 'individual';
}

console.log(`SFP Validation Mode: ${validationMode}`);
return validationMode;
result-encoding: string

- name: Run Commands Based on the Validation Mode
run: |
echo "Running commands based on the validation mode: ${{ steps.sfp-validation-mode.outputs.result }}"
19 changes: 19 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Nightly Build
on:
workflow_dispatch:
schedule:
- cron: "* * * * *"

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: |
echo "Running nightly tests..."
# Simulate test commands
- name: Mark workflow as successful
if: success()
run: echo "Tests passed"