Skip to content

chore: add new action to revert direct push into master (#27) #1

chore: add new action to revert direct push into master (#27)

chore: add new action to revert direct push into master (#27) #1

Workflow file for this run

name: Enforce PR for dev Branch
on:
push:
branches:
- master
jobs:
revert-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Revert direct push
run: |
git checkout -b temp-branch
git push origin temp-branch
git reset --hard HEAD~1
git push origin master --force
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
token: ${{secrets.GITHUB_TOKEN}}
commit-message: 'Auto PR: Reverted direct push to master'
branch: master
title: 'Revert Direct Push and Create PR'
body: |
A direct push to master was detected and reverted. Please review the changes and merge through this PR.