Skip to content

Commit

Permalink
Merge pull request #99 from felixoi/main
Browse files Browse the repository at this point in the history
Added action input to run octodns-sync in force mode
  • Loading branch information
solvaholic authored Feb 13, 2023
2 parents 9cfbedd + 38108a1 commit b2f3726
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ Really do it? Set "--doit" to do it; Any other string to not do it.

Default `""` (empty string).

### `force`

Run octodns-sync in force mode? Set "Yes" to do it.

Default `"No"`.

### `add_pr_comment`

Add plan as a comment, when triggered by a pull request? Set "Yes" to do it.
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
not do it.'
required: false
default: ''
force:
description: 'Run octodns-sync in force mode?'
required: false
default: 'No'
pr_comment_token:
description: 'Provide a token to use, if you set add_pr_comment to Yes.'
required: true
Expand All @@ -37,6 +41,7 @@ runs:
env:
CONFIG_PATH: ${{ inputs.config_path }}
DOIT: ${{ inputs.doit }}
FORCE: ${{ inputs.force }}
run: ${{ github.action_path }}/scripts/run.sh
shell: bash
working-directory: ${{ github.workspace }}
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- ([#93](https://github.com/solvaholic/octodns-sync/pull/93)) Add output **log** to include output from `octodns-sync` command.
- ([#98](https://github.com/solvaholic/octodns-sync/pull/98)) Integrate octodns' force flag.

### Removed

Expand Down
10 changes: 9 additions & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

_config_path=$CONFIG_PATH
_doit=$DOIT
_force=$FORCE

# Run octodns-sync.
_logfile="${GITHUB_WORKSPACE}/octodns-sync.log"
Expand All @@ -23,7 +24,14 @@ if [ ! "${_doit}" = "--doit" ]; then
_doit=
fi

if ! octodns-sync --config-file="${_config_path}" ${_doit} \
if [ "${_force}" = "Yes" ]; then
echo "INFO: Running octodns-sync in force-mode"
_force="--force"
else
_force=
fi

if ! octodns-sync --config-file="${_config_path}" ${_doit} ${_force} \
1>"${_planfile}" 2>"${_logfile}"; then
echo "FAIL: octodns-sync exited with an error."
echo "FAIL: Here are the contents of ${_logfile}:"
Expand Down

0 comments on commit b2f3726

Please sign in to comment.