nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 22.05-pre 32 lines 1.3 kB view raw
1name: "Direct Push Warning" 2on: 3 push: 4 branches: 5 - master 6 - release-** 7jobs: 8 build: 9 runs-on: ubuntu-latest 10 if: github.repository_owner == 'NixOS' 11 env: 12 GITHUB_SHA: ${{ github.sha }} 13 GITHUB_REPOSITORY: ${{ github.repository }} 14 steps: 15 - name: Check if commit is a merge commit 16 id: ismerge 17 run: | 18 ISMERGE=$(curl -H 'Accept: application/vnd.github.groot-preview+json' -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ env.GITHUB_REPOSITORY }}/commits/${{ env.GITHUB_SHA }}/pulls | jq -r '.[] | select(.merge_commit_sha == "${{ env.GITHUB_SHA }}") | any') 19 echo "::set-output name=ismerge::$ISMERGE" 20 # github events are eventually consistent, so wait until changes propagate to thier DB 21 - run: sleep 60 22 if: steps.ismerge.outputs.ismerge != 'true' 23 - name: Warn if the commit was a direct push 24 if: steps.ismerge.outputs.ismerge != 'true' 25 uses: peter-evans/commit-comment@v1 26 with: 27 body: | 28 @${{ github.actor }}, you pushed a commit directly to master/release branch 29 instead of going through a Pull Request. 30 31 That's highly discouraged beyond the few exceptions listed 32 on https://github.com/NixOS/nixpkgs/issues/118661