https://github.com/levonet/action-restore-branch
Github Action that can restore a branch if it has been removed
https://github.com/levonet/action-restore-branch
Last synced: 4 months ago
JSON representation
Github Action that can restore a branch if it has been removed
- Host: GitHub
- URL: https://github.com/levonet/action-restore-branch
- Owner: levonet
- License: mit
- Created: 2021-10-05T18:41:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T11:55:27.000Z (over 3 years ago)
- Last Synced: 2025-09-29T21:11:03.175Z (9 months ago)
- Language: JavaScript
- Size: 437 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action: Restore Branch
[](https://github.com/levonet/action-restore-branch/actions/workflows/test.yml)
If the branch has been removed, the action will restore the branch.
This Github Action is used with the workflow trigger when a pull request has been `closed`.
Temporarily restoring a branch can be useful when you are about to trigger workflow runs (`workflow_dispatch`)
after closing Pull Request.
For example, to initiate the removal of deployed infrastructure or services.
```yml
on:
pull_request:
types:
- closed
jobs:
cleaner:
runs-on: ubuntu-latest
steps:
- name: Restore branch
uses: levonet/action-restore-branch@master
with:
get_back: true
# ... Do something ...
```
## Inputs
### `github_token`
Personal access token (PAT) used to fetch the repository. The PAT is configured
with the local git config, which enables your scripts to run authenticated git
commands. The post-job step removes the PAT.
Default: `${{ github.token }}`
### `branch`
Source branch of the pull request in a workflow run.
Default: `${{ github.head_ref }}`
### `sha`
The commit SHA that triggered the workflow run.
Default: `${{ github.event.pull_request.head.sha }}`
### `get_back`
Return the branch after the end of job to the state in which it was before.
That is, if the branch was removed before the start of the action,
then after the end of the job it will be removed again.
Default: `false`
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)