Search code examples
githubgithub-actions

Is possible to build a Github action that will trigger when a PR is opened, and create an 'undo PR‘?


I am trying to make a backup PR for my repo when there is new PR merged.

Is this possible to do it with GitHub actions?

Also, could it be a stand alone app/repo to manage other repos?


Solution

  • You would probably only create a revert PR only after the initial PR was merged, otherwise you could run into all kinds of issues.

    This can definitely be implemented via GitHub Actions, by getting triggered by a PR merged trigger and checking the added commits in the initial PR and creating a revert for them back to whatever the base branch was before.

    Still, GitHub is already able to do this natively with a click of a button in a PR, so I'm not sure what need this would fill.

    See GitHub Docs: Reverting a pull request