diff --git a/.github/workflows/nix-action.yml b/.github/workflows/nix-action.yml index 5adc150..38435c7 100644 --- a/.github/workflows/nix-action.yml +++ b/.github/workflows/nix-action.yml @@ -7,8 +7,9 @@ on: branches: - master pull_request: - branches: - - '**' + paths: + - .github/workflows/** + pull_request_target: jobs: build: @@ -19,6 +20,18 @@ jobs: - 'coq = "master"' fail-fast: false steps: + - name: Determine which ref to test + run: | + if [ ${{ github.event_name }} = "push" ]; then + echo "tested_ref=${{ github.ref }}" >> $GITHUB_ENV + else + merge_commit=$(git ls-remote ${{ github.event.repository.html_url }} refs/pull/${{ github.event.number }}/merge | cut -f1) + if [ -z "$merge_commit" ]; then + echo "tested_ref=refs/pull/${{ github.event.number }}/head" >> $GITHUB_ENV + else + echo "tested_ref=refs/pull/${{ github.event.number }}/merge" >> $GITHUB_ENV + fi + fi - uses: cachix/install-nix-action@v12 with: nix_path: nixpkgs=channel:nixpkgs-unstable @@ -33,5 +46,7 @@ jobs: with: name: math-comp - uses: actions/checkout@v2 + with: + ref: ${{ env.tested_ref }} - run: > nix-build https://coq.inria.fr/nix/toolbox --argstr job aac-tactics --arg override '{ ${{ matrix.overrides }}; aac-tactics = builtins.filterSource (path: _: baseNameOf path != ".git") ./.; }'