# Generated by `sfdt ci init --provider github --type deploy --runner action`.
# Smart delta validation on pull requests via the SFDT action ({{actionRef}}):
# a code quality scan (results appear under Security > Code scanning), then a
# check-only deploy of the changed-metadata delta against the PR base branch.
# Generate the matching real-deploy pipeline with --type release.
#
# The quality scan expects a committed .sfdt/config.json (run `sfdt init`); it
# is non-blocking, so a failed or skipped scan never blocks the validation.
#
# Required repository secrets (Settings > Secrets and variables > Actions):
{{authSecretsDoc}}
name: SFDT Smart Deploy
on:
  pull_request:
    types: [opened, synchronize, reopened]
  workflow_dispatch: {}
permissions:
  contents: read
  security-events: write
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Code quality scan
        uses: {{actionRef}}
        continue-on-error: true
        with:
          args-json: '["quality","--output-file","sfdt-quality.sarif"]'
          node-version: '{{nodeVersion}}'
      - name: Upload code scanning results
        if: always() && hashFiles('sfdt-quality.sarif') != ''
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: sfdt-quality.sarif
      - name: Smart delta validation
        uses: {{actionRef}}
        with:
          args-json: '["deploy","--smart","--org","{{org}}","--delta-base","origin/${{ github.event.pull_request.base.ref }}","--dry-run"]'
          auth-method: {{authMethod}}
          org-alias: {{org}}
          node-version: '{{nodeVersion}}'
          {{authInputs}}
