Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use masterBranchName as fallback if branch or targetBranch are not defined #590

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading