Skip to content

Commit

Permalink
chore: Deprecate input.value in favor of input.vars
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 27, 2024
1 parent 48b7bae commit 1d72e01
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./
with:
file: |
test/input.yaml
test/input2.yaml
test/*_input.yaml
vars: |
hello=world
tag=latest
- name: Deprecated values input
uses: ./
with:
file: |
test/input.yaml
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the [yampl](https://github.com/clevyr/yampl#readme) readme for more details
| Name | Description | Required | Default |
|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------|
| `file` | Path to the file that should be patched. | `true` | |
| `values` | List of values to replace in the provided file. | `true` | |
| `vars` | List of vars to replace in the provided file. | `true` | |
| `commit_message` | If set, this action will invoke [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) with the given commit message. | `false` | `""` |
| `yampl_version` | The Yampl version to install. | `false` | `latest` |

Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
uses: clevyr/yampl-action@v1
with:
file: deployment.yaml
values: |
vars: |
tag=${{ github.sha }}
commit_message: "chore: Bump deployment to ${{ steps.short-sha.outputs.sha }}"
```
15 changes: 13 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ inputs:
file:
description: Path to the file that should be patched.
required: true
values:
vars:
description: List of values to replace in the provided file.
required: true
values:
description: "Deprecated: Use vars instead"
required: true
commit_message:
description: If set, this action will invoke stefanzweifel/git-auto-commit-action with the given commit message.
default: ""
Expand All @@ -28,10 +31,18 @@ runs:
shell: bash
env:
FILE: ${{ inputs.file }}
VARS: ${{ inputs.vars }}
VALUES: ${{ inputs.values }}
run: |
shopt -s globstar 2>/dev/null || true
yampl --inplace --var="$VALUES" $FILE
opts=( --inplace )
if [[ -n "$VARS" ]]; then
opts+=( --var="$VALUES" )
fi
if [[ -n "$VALUES" ]]; then
opts+=( --value="$VALUES" )
fi
yampl "${opts[@]}" $FILE
- name: Commit changes
if: inputs.commit_message
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down

0 comments on commit 1d72e01

Please sign in to comment.