Skip to content

Commit

Permalink
revert input 'sync_command' to 'pull' with args
Browse files Browse the repository at this point in the history
  • Loading branch information
aormsby committed Oct 6, 2020
1 parent d7f5b0e commit 420973e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ As with any Github Action, you must include it in a workflow for your repo to ru

| Name | Required? | Default | Example |
| ------------------- |:------------------: | ----------------- | ----------
| upstream_repository | :white_check_mark: | | aormsby/Fork-Sync-With-Upstream-action |
| upstream_branch | :white_check_mark: | | 'master', 'main', 'dev' |
| target_branch | :white_check_mark: | | 'master', 'main', 'prod' |
| github_token | | | ${{ secrets.GITHUB_TOKEN }} |
| upstream_repository | :white_check_mark: | | aormsby/Fork-Sync-With-Upstream-action |
| upstream_branch | :white_check_mark: | | 'master', 'main', 'dev' |
| target_branch | :white_check_mark: | | 'master', 'main', 'prod' |
| github_token | | | ${{ secrets.GITHUB_TOKEN }} |

For **github_token** - use `${{ secrets.GITHUB_TOKEN }}` where `GITHUB_TOKEN` is the name of the secret in your repo ([see docs for help](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-variables-and-secrets-in-a-workflow))

#### Advanced Use (all optional args)

| Name | Required? | Default | Example |
| ------------------- |:------------------: | ----------------- | ----------
| git_checkout_args | | | '--recurse-submodules' |
| git_fetch_args | | | '--tags' |
| git_log_format_args | | '--pretty=oneline' | '--graph --pretty=oneline' |
| git_sync_command | | 'pull' | 'pull' or 'merge --ff-only' or 'reset --hard' |
| git_push_args | | | '--force' |
| Name | Required? | Default | Example |
| ------------------- |:------------------: | ------------------ | ----------
| git_checkout_args | | | '--recurse-submodules' |
| git_fetch_args | | | '--tags' |
| git_log_format_args | | '--pretty=oneline' | '--graph --pretty=oneline' |
| git_pull_args | | 'pull' | '--ff-only' |
| git_push_args | | | '--force' |

### Output Variables

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
upstream_repository: panr/hugo-theme-hello-friend
upstream_branch: master
target_branch: master
git_sync_command: pull --ff-only # optional arg use, defaults to pull
git_pull_args: --ff-only # optional arg use, defaults to simple 'pull'
github_token: ${{ secrets.GITHUB_TOKEN }} # optional, for accessing repos that require authentication

# Step 3: Display a message if 'sync' step had new commits (simple test)
Expand Down
6 changes: 3 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ inputs:
required: false
default: '--pretty=oneline'

git_sync_command:
description: 'Which git command to use for sync (eg "merge --ff-only" or "reset --hard"), default = pull'
git_pull_args:
description: 'Any extra args to pass to `git push` like --ff-only or --tags, default = ""'
required: false
default: 'pull'
default: ''

git_push_args:
description: 'Any extra args to pass to `git push` like --force, default = ""'
Expand Down
6 changes: 3 additions & 3 deletions upstream-sync.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

set -e
# do not quote GIT_SYNC_COMMAND or GIT_*_ARGS. As they may contain
# do not quote GIT_PULL_ARGS or GIT_*_ARGS. As they may contain
# more than one argument.

# fail if upstream_repository is not set in workflow
Expand Down Expand Up @@ -43,8 +43,8 @@ git log upstream/"${INPUT_UPSTREAM_BRANCH}" "${LOCAL_COMMIT_HASH}"..HEAD ${INPUT

# sync from upstream to target_branch
echo 'Syncing...' 1>&1
# sync_command examples: "pull", "merge --ff-only", "reset --hard"
git ${INPUT_GIT_SYNC_COMMAND} upstream "${INPUT_UPSTREAM_BRANCH}"
# pull_args examples: "--ff-only", "--tags"
git pull ${INPUT_GIT_PULL_ARGS} upstream "${INPUT_UPSTREAM_BRANCH}"
echo 'Sync successful' 1>&1

# push to origin target_branch
Expand Down

0 comments on commit 420973e

Please sign in to comment.