Skip to content

Commit

Permalink
feat: add dry_run option (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt authored Mar 19, 2020
1 parent 2d9a019 commit 106379e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/test-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
tar_path: gapic-maps-routes-v1-go/cloud.google.com/go/maps
tar_strip_components: 4
cache_service_account: ${{ secrets.SERVICE_ACCOUNT_CACHE }}
dry_run: true
4 changes: 4 additions & 0 deletions actions/gapic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Service account json string for Bazel cache.

Bucket name for Bazel cache.

### `dry_run`

Run without writes to repo.

## Usage

```yaml
Expand Down
3 changes: 3 additions & 0 deletions actions/gapic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ inputs:
description: "Bucket name for Bazel cache"
required: false
default: gapic_action_bazel_cache
dry_run:
description: "Do not push changes"
required: false
runs:
using: "docker"
image: "Dockerfile"
3 changes: 2 additions & 1 deletion actions/gapic/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ if [ $differs_from_master ]; then

[[ -n $(git ls-remote --heads origin ${BRANCH}) ]] && has_branch=1 || has_branch=0

if [[ !$has_branch || -n $(git diff "origin/${BRANCH}") ]]; then

if [[ !$has_branch || -n $(git diff "origin/${BRANCH}") && -z $INPUT_DRY_RUN ]]; then
git push -f -u origin $BRANCH

curl \
Expand Down

0 comments on commit 106379e

Please sign in to comment.