Skip to content

Commit b75e8a9

Browse files
authored
Use masterBranchName as fallback if branch or targetBranch are not defined (#590)
Signed-off-by: Frank Jogeleit <[email protected]>
1 parent a01638e commit b75e8a9

File tree

12 files changed

+4963
-2968
lines changed

12 files changed

+4963
-2968
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
commitChange: 'false'
7878
- name: Cat Updated values.yaml
7979
run: cat __tests__/fixtures/values.yaml
80-
80+
8181
test-multiple-file-changes:
8282
runs-on: ubuntu-latest
8383
steps:

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ Determine the behavior for none existing properties or array elements.
115115
| createPR | Create a PR from __branch__ to __targetBranch__. Use 'true' to enable it | `false` |
116116
| title | Custom title for the created Pull Request | 'Merge: {{message}}' |
117117
| description | Custom description for the created Pull Request | '' |
118-
| targetBranch | Opens a PR from __branch__ to __targetBranch__ if createPR is set to 'true' | `master` |
118+
| masterBranchName | Branch name of your master branch
119+
| targetBranch | Opens a PR from __branch__ to __targetBranch__ if createPR is set to 'true' | `${masterBranchName}` |
119120
| 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}} |
120-
| branch | The updated YAML file will be committed to this branch, branch will be created if not exists | `master` |
121-
| force | Allows force pushes | `false` |
122-
| masterBranchName | Branch name of your master branch | `master` |
121+
| branch | The updated YAML file will be committed to this branch, branch will be created if not exists | `${masterBranchName}` |
122+
| force | Allows force pushes | `false` | | `master` |
123123
| githubAPI | BaseURL for all GitHub REST API requests | https://api.github.com |
124124
| token | GitHub API Token which is used to create the PR, have to have right permissions for the selected repository | ${{github.token}} |
125125
| commitUserName | Name used for the commit user | github-actions[bot] |

__tests__/action.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,18 @@ test('multiple changes in multiple files with different format', async () => {
361361
expect(results[1].json.frontend).toEqual(true)
362362
console.info(results[1].content)
363363
})
364+
365+
test('multiple changes on the same root object', async () => {
366+
process.env['VALUE_FILE'] = 'fixtures/values.yaml'
367+
process.env['CHANGES'] =
368+
'{"backend.version": "v1.1.0", "backend.test": "true"}'
369+
370+
const [{ json, content }] = await runTest<{
371+
backend: { version: string; test: string }
372+
containers: { name: string; image: string }[]
373+
}>(new EnvOptions())
374+
375+
expect(json.backend.version).toEqual('v1.1.0')
376+
expect(json.backend.test).toEqual('true')
377+
console.info(content)
378+
})

action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ inputs:
3131
branch:
3232
required: false
3333
description: 'Branch to commit the change, will be created if not exist'
34-
default: 'master'
34+
default: ''
3535
force:
3636
required: false
3737
description: 'Branch to commit the change, will be created if not exist'
@@ -43,7 +43,7 @@ inputs:
4343
targetBranch:
4444
required: false
4545
description: 'Target Branch for the created PullRequest'
46-
default: master
46+
default: ''
4747
githubAPI:
4848
required: false
4949
description: 'GitHub BaseURL'

0 commit comments

Comments
 (0)