Skip to content

Instantly share code, notes, and snippets.

@benc-uk
Last active October 26, 2022 11:08
Show Gist options
  • Save benc-uk/3aa870811ed07b7c59994b43c1e17cce to your computer and use it in GitHub Desktop.
Save benc-uk/3aa870811ed07b7c59994b43c1e17cce to your computer and use it in GitHub Desktop.
GitHub Actions
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