From ff722f22205ad5578d45e6fe463cc25e1cb9571b Mon Sep 17 00:00:00 2001 From: Attilio Borello Date: Fri, 9 Jun 2023 15:13:18 +0200 Subject: [PATCH 1/3] feat(tuning): set default branch to main --- README.md | 10 +++++----- action.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aa62462..69781ca 100644 --- a/README.md +++ b/README.md @@ -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 * * *" @@ -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 ``` @@ -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 diff --git a/action.yml b/action.yml index 733e0ad..c3f80db 100644 --- a/action.yml +++ b/action.yml @@ -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 From e1b6a8fc4272f21fa8262af019fa5125a692bcf6 Mon Sep 17 00:00:00 2001 From: Attilio Borello Date: Fri, 9 Jun 2023 15:13:54 +0200 Subject: [PATCH 2/3] feat(tuning): improve performance using alpine/git --- Dockerfile | 5 ++--- entrypoint.sh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index efdf6b2..5d5a6f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/entrypoint.sh b/entrypoint.sh index d05d485..fc87900 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/sh BASE_BRANCH=$1 RESET_BRANCH=$2 From 4c405b47738799214d574b2a2d9fde76adc2ac63 Mon Sep 17 00:00:00 2001 From: Attilio Borello Date: Fri, 9 Jun 2023 15:16:02 +0200 Subject: [PATCH 3/3] fix(tmp_path): fixing tmp directory to avoid errors when creating it --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index fc87900..9a3b691 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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