Last active
October 26, 2022 11:08
-
-
Save benc-uk/3aa870811ed07b7c59994b43c1e17cce to your computer and use it in GitHub Desktop.
GitHub Actions
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: Detect pushes direct to main | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
issues: write | |
jobs: | |
ci-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create issue for direct push | |
if: github.ref == 'refs/heads/main' && github.event.head_commit.committer.name != 'GitHub' | |
uses: dacbd/create-issue-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: "Direct push to main: ${{ github.actor }}" | |
body: | | |
Whoops! Looks like **${{ github.actor }}** pushed directly to the main branch! ๐ | |
I'm sure this was just a innocent mistake ๐ | |
- Message: ${{ github.event.head_commit.message }} | |
- URL: ${{ github.event.head_commit.url }} | |
labels: whoops |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment