Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y git
FROM alpine/git

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Reset Git Branch

Reset a specific branch to another. Useful if you need a specific branch to be reset to say master at given intervals. NOTE: this action performs a _reset_ on the repository and is **destructive** - you will lose any changes made to the branch being reset. Be sure this is what you want to do before running.
Reset a specific branch to another. Useful if you need a specific branch to be reset to say main at given intervals. NOTE: this action performs a _reset_ on the repository and is **destructive** - you will lose any changes made to the branch being reset. Be sure this is what you want to do before running.

## Usage

Example Workflow using a schedule.

```yaml
name: Rest Dev Branch to Master at 1am each day
name: Rest Dev Branch to Main at 1am each day
on:
schedule:
- cron: "0 1 * * *"
Expand All @@ -16,8 +16,8 @@ jobs:
name: Runner
runs-on: ubuntu-latest
steps:
- name: Reset dev branch to master
uses: nicksnell/action-reset-repo@master
- name: Reset dev branch to main
uses: nicksnell/action-reset-repo@main
with:
reset_branch: dev
```
Expand All @@ -27,7 +27,7 @@ jobs:
| name | value | default | description |
| ---- | ----- | ------- | ----------- |
| github_token | string | | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. |
| base_branch | string | 'master' | Branch to be used to reset too |
| base_branch | string | 'main' | Branch to be used to reset too |
| reset_branch | string | - | Determines the branch to be reset |

## License
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
base_branch:
description: "Branch you want to use as the base to reset too"
required: true
default: "master"
default: "main"
reset_branch:
description: "Branch you want to reset"
required: true
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -l
#!/bin/sh

BASE_BRANCH=$1
RESET_BRANCH=$2
Expand All @@ -18,7 +18,7 @@ echo "BASE_BRANCH=${BASE_BRANCH}"
echo "RESET_BRANCH=${RESET_BRANCH}"


mkdir _tmp && cd _tmp
mkdir -p /tmp/_tmp && cd /tmp/_tmp

git init

Expand Down