From 392f92f22ab6732bace5988e700c6964fa67f9af Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Tue, 21 Jan 2025 10:29:00 +0100 Subject: [PATCH] Add workflows --- .github/workflows/pytest.yaml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/pytest.yaml diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml new file mode 100644 index 0000000..460b5f6 --- /dev/null +++ b/.github/workflows/pytest.yaml @@ -0,0 +1,45 @@ +on: + pull_request: + branches: [ main ] + pull_request_target: + branches: [ main ] + types: [ labeled, opened, reopened, synchronize ] + +# concurrency: +# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} +# cancel-in-progress: true + +jobs: + check: + name: Check permissions + runs-on: ubuntu-latest + steps: + - if: > + github.repository != github.event.pull_request.head.repo.full_name && + ! contains(github.event.pull_request.labels.*.name, 'safe to test') + run: | + echo "Pytest workflow will not run for branch in fork without label \`safe to test\`." >>$GITHUB_STEP_SUMMARY + exit 1 + + pytest: + needs: [ check ] + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + runs-on: ${{ matrix.os }} + + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + fetch-depth: ${{ env.depth }} + ref: ${{ github.event_name != 'pull_request_target' && github.ref || github.event.pull_request.head.ref }} + + - name: Leak a secret + env: + BAR: ${{ secrets.FOO }} + run: echo "'FOO' secret contains '$BAR'!"