Skip to content

Commit

Permalink
Use masterBranchName as fallback if branch or targetBranch are not de…
Browse files Browse the repository at this point in the history
…fined (#590)

Signed-off-by: Frank Jogeleit <[email protected]>
  • Loading branch information
fjogeleit authored Dec 18, 2024
1 parent a01638e commit b75e8a9
Show file tree
Hide file tree
Showing 12 changed files with 4,963 additions and 2,968 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
commitChange: 'false'
- name: Cat Updated values.yaml
run: cat __tests__/fixtures/values.yaml

test-multiple-file-changes:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Determine the behavior for none existing properties or array elements.
| createPR | Create a PR from __branch__ to __targetBranch__. Use 'true' to enable it | `false` |
| title | Custom title for the created Pull Request | 'Merge: {{message}}' |
| description | Custom description for the created Pull Request | '' |
| targetBranch | Opens a PR from __branch__ to __targetBranch__ if createPR is set to 'true' | `master` |
| masterBranchName | Branch name of your master branch
| targetBranch | Opens a PR from __branch__ to __targetBranch__ if createPR is set to 'true' | `${masterBranchName}` |
| repository | The Repository where the YAML file is located and should be updated. You have to checkout this repository too and set the working-directory for this action to the same as the repository. See the example below | ${{github.repository}} |
| branch | The updated YAML file will be committed to this branch, branch will be created if not exists | `master` |
| force | Allows force pushes | `false` |
| masterBranchName | Branch name of your master branch | `master` |
| branch | The updated YAML file will be committed to this branch, branch will be created if not exists | `${masterBranchName}` |
| force | Allows force pushes | `false` | | `master` |
| githubAPI | BaseURL for all GitHub REST API requests | https://api.github.com |
| token | GitHub API Token which is used to create the PR, have to have right permissions for the selected repository | ${{github.token}} |
| commitUserName | Name used for the commit user | github-actions[bot] |
Expand Down
15 changes: 15 additions & 0 deletions __tests__/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,18 @@ test('multiple changes in multiple files with different format', async () => {
expect(results[1].json.frontend).toEqual(true)
console.info(results[1].content)
})

test('multiple changes on the same root object', async () => {
process.env['VALUE_FILE'] = 'fixtures/values.yaml'
process.env['CHANGES'] =
'{"backend.version": "v1.1.0", "backend.test": "true"}'

const [{ json, content }] = await runTest<{
backend: { version: string; test: string }
containers: { name: string; image: string }[]
}>(new EnvOptions())

expect(json.backend.version).toEqual('v1.1.0')
expect(json.backend.test).toEqual('true')
console.info(content)
})
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ inputs:
branch:
required: false
description: 'Branch to commit the change, will be created if not exist'
default: 'master'
default: ''
force:
required: false
description: 'Branch to commit the change, will be created if not exist'
Expand All @@ -43,7 +43,7 @@ inputs:
targetBranch:
required: false
description: 'Target Branch for the created PullRequest'
default: master
default: ''
githubAPI:
required: false
description: 'GitHub BaseURL'
Expand Down
Loading

0 comments on commit b75e8a9

Please sign in to comment.