π (repo) [DSDK-500]: Prepare CI for external contributions #2602
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Checks | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
env: | |
FORCE_COLOR: "1" | |
IS_FORKED: ${{ github.event.pull_request.head.repo.fork}} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
auto-assign: | |
name: Auto assign | |
runs-on: ubuntu-latest | |
steps: | |
- uses: toshimaru/auto-author-assign@v2.1.1 | |
danger: | |
name: Run Danger check | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-toolchain-composite | |
- name: Danger | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Workaround when using custom runners | |
# https://github.com/danger/danger-js/issues/1374 | |
DANGER_GITHUB_API_BASE_URL: "https://api.github.com" | |
run: ./.github/actions/danger-check.sh | |
checks: | |
name: Run health check and unit tests | |
needs: [danger] | |
runs-on: ${{ github.env.IS_FORKED && 'ubuntu-latest' || 'ledgerhq-device-sdk' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-toolchain-composite | |
- name: Health check | |
id: health-check | |
run: pnpm health-check | |
- name: Tests | |
id: unit-tests | |
if: ${{ steps.health-check.outputs.result == 'success' }} | |
run: pnpm test:coverage -- --max-warnings=0 | |
- uses: sonarsource/sonarqube-scan-action@master | |
if: ${{ steps.unit-tests.outputs.result == 'success' && github.actor != 'dependabot[bot]' || !github.env.IS_FORKED }} | |
env: | |
SONAR_TOKEN: ${{ secrets.GREEN_SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.GREEN_SONAR_HOST_URL }} |