diff --git a/README.md b/README.md index 8f3b2cf..9ca4111 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This Github Action is that send pull request on bundle update. To draw bundle update diff table, I'd like use [bundler-diff](https://github.com/sinsoku/bundler-diff), Thank you. -This Github Action is running on **[ruby2.6-alipne](https://github.com/docker-library/ruby/blob/5c9e21cbf79b7f36d505555c9ecd62cf0f7e07f8/2.6/alpine3.10/Dockerfile)**. +This Github Action is running on **[ruby2.6-alpine](https://github.com/docker-library/ruby/blob/5c9e21cbf79b7f36d505555c9ecd62cf0f7e07f8/2.6/alpine3.10/Dockerfile)**. ## Usage ※ Without Gemfile and Gemfile.lock, this workflow is failure. @@ -28,8 +28,35 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} git_user_name: example_name git_email: test@example.com - reviewers: supermanner,hoge,fuga // optional - bundler_version: 2.0.1 // optional + reviewers: supermanner,hoge,fuga ## optional + bundler_version: 2.0.1 ## optional +``` +### Or to update Gemfile.lock when Gemfile changed + +``` +name: pull request on bundle update +on: + push: + paths: + - 'Gemfile' + + +jobs: + bundle-update: + name: bundle update + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: pull request on bundle update + uses: woodcock3/pull-request-on-bundle-update@v1.0.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + git_user_name: ${{ secrets.HUB_USER }} + git_email: ${{ secrets.HUB_EMAIL }} + bundler_version: 2.1.4 ## optional ``` ## Demo diff --git a/entrypoint.sh b/entrypoint.sh index 8385f98..0ae758d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,15 +17,15 @@ if [[ -z "$GIT_EMAIL" ]]; then exit 1 fi -git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY" +git remote set-url origin "https://github.com/$GIT_USER_NAME/$GITHUB_REPOSITORY.git" git checkout master BRANCH_NAME="bundle_update/$(date "+%Y%m%d_%H%M%S")" git checkout -b ${BRANCH_NAME} export PATH="/usr/local/bundle/bin:$PATH" -if [[ -n "$INPUT_BUNDLER_VERSION" ]]; then - gem install bundler -v "$INPUT_BUNDLER_VERSION" +if [[ -n "$BUNDLER_VERSION" ]]; then + gem install bundler -v "$BUNDLER_VERSION" else gem install bundler fi @@ -44,6 +44,7 @@ fi export GITHUB_USER="$GITHUB_ACTOR" +git config --global --add safe.directory /github/workspace git config --global user.name $GIT_USER_NAME git config --global user.email $GIT_EMAIL