Skip to content

Commit

Permalink
Post a warning if a pull request is created from the master branch (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong authored Nov 20, 2022
1 parent 025172a commit d72df78
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/check-branch-name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check pull request head branch name

on:
pull_request_target:
types:
- opened

jobs:
check_branch_name:
runs-on: ubuntu-latest
if: github.head_ref == 'master' && github.repository == 'CleverRaven/Cataclysm-DDA'
steps:
- name: Post warning
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "You are creating a pull request with the master branch as the head branch. This is likely a mistake unless you really know what you are doing. You may read https://docs.github.com/en/get-started/quickstart/contributing-to-projects#creating-a-branch-to-work-on for a typical workflow of contributing to a project on GitHub."
});

0 comments on commit d72df78

Please sign in to comment.