name: CDI E2E
on:
pull_request:
branches:
- 'main'
types:
- opened
- synchronize
- reopened
- labeled
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect changes (e2e)
if: ${{ contains(github.event.pull_request.labels.*.name, 'ok-to-test') }}
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 id: filter
with:
base: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.head.sha }}
filters: |
code:
- '**/*.rs'
- '**/*.toml'
- '**/*.lock'
- 'Cargo.lock'
- '.cargo/**'
# Action/workflow bumps must run the E2E too - a broken or
# malicious action update would otherwise merge untested.
- '.github/workflows/**'
- '.github/actions/**'
ci:
needs: changes
if: ${{ contains(github.event.pull_request.labels.*.name, 'ok-to-test') && needs.changes.outputs.code == 'true' }}
permissions:
contents: read
uses: ./.github/workflows/ci.yaml
with:
commit-hash: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}
tag: ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
target-branch: ${{ github.event.pull_request.base.ref }}
ci-complete:
name: CI Complete
needs: [changes, ci]
if: always() && contains(github.event.pull_request.labels.*.name, 'ok-to-test')
runs-on: ubuntu-latest
steps:
- name: Check CI result
env:
CODE_CHANGED: ${{ needs.changes.outputs.code }}
CI_RESULT: ${{ needs.ci.result }}
run: |
# Only an explicit "false" from the changes job counts as a
# docs-only PR. An empty value means the changes job itself failed,
# and the gate must fail rather than let the PR merge untested.
if [[ "${CODE_CHANGED}" == "false" ]]; then
echo "✓ No code changes - CI skipped"
exit 0
fi
if [[ "${CI_RESULT}" == "success" ]]; then
echo "✓ CI passed"
exit 0
fi
echo "✗ CI failed: ${CI_RESULT} (code changed: '${CODE_CHANGED}')"
exit 1