Skip to content

Commit 4278b29

Browse files
authored
doc: update information about target property (#499)
* doc: update information about property add to .gitignore * chore: add test for triggering merge when version bump lower than target
1 parent b85d406 commit 4278b29

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules/
33
.idea
44
.nyc_output
5+
.tap/

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ Error: Resource not accessible by integration
2020

2121
## Inputs
2222

23-
| input | required | default | description |
23+
| input | required | default | description |
2424
|----------------------------|----------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
25-
| `github-token` | No | `${{github.token}}` | A GitHub token. |
26-
| `exclude` | No | | A comma or semicolon separated value of packages that you don't want to auto-merge and would like to manually review to decide whether to upgrade or not. |
27-
| `approve-only` | No | `false` | If `true`, the PR is only approved but not merged. |
28-
| `merge-method` | No | `squash` | The merge method you would like to use (squash, merge, rebase). |
29-
| `merge-comment` | No | `''` | An arbitrary message that you'd like to comment on the PR after it gets auto-merged. This is only useful when you're receiving too much of noise in email and would like to filter mails for PRs that got automatically merged. |
30-
| `use-github-auto-merge` | No | `false` | If `true`, the PR is marked as auto-merge and will be merged by GitHub when status checks are satisfied.<br /><br />_NOTE_: This feature only works when all of the following conditions are met.<br />- The repository enables auto-merge. <br />- The pull request base must have a branch protection rule. <br />- The pull request's status checks are not yet satisfied.<br /></br>Refer to [the official document](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) about GitHub auto-merge. |
31-
| `target` | No | `any` | A flag to only auto-merge updates based on Semantic Versioning.<br />Possible options are: `major, premajor, minor, preminor, patch, prepatch, prerelease, any`.<br /><br />For more details on how semantic version difference is calculated please see [semver](https://www.npmjs.com/package/semver) package.<br /><br />If you set a value other than `any`, PRs that are not semantic version compliant are skipped. An example of a non-semantic version is a commit hash when using git submodules. |
32-
| `pr-number` | No | | A pull request number, only required if triggered from a workflow_dispatch event. Typically this would be triggered by a script running in a separate CI provider. See [Trigger action from workflow_dispatch event](#trigger-action-from-workflow_dispatch-event) example. |
33-
| `skip-commit-verification` | No | `false` | If `true`, then the action will not expect the commits to have a verification signature. It is required to set this to `true` in GitHub Enterprise Server. |
34-
| `skip-verification` | No | `false` | If true, the action will not validate the user or the commit verification status |
25+
| `github-token` | No | `${{github.token}}` | A GitHub token. |
26+
| `exclude` | No | | A comma or semicolon separated value of packages that you don't want to auto-merge and would like to manually review to decide whether to upgrade or not. |
27+
| `approve-only` | No | `false` | If `true`, the PR is only approved but not merged. |
28+
| `merge-method` | No | `squash` | The merge method you would like to use (squash, merge, rebase). |
29+
| `merge-comment` | No | `''` | An arbitrary message that you'd like to comment on the PR after it gets auto-merged. This is only useful when you're receiving too much of noise in email and would like to filter mails for PRs that got automatically merged. |
30+
| `use-github-auto-merge` | No | `false` | If `true`, the PR is marked as auto-merge and will be merged by GitHub when status checks are satisfied.<br /><br />_NOTE_: This feature only works when all of the following conditions are met.<br />- The repository enables auto-merge. <br />- The pull request base must have a branch protection rule. <br />- The pull request's status checks are not yet satisfied.<br /></br>Refer to [the official document](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) about GitHub auto-merge. |
31+
| `target` | No | `any` | A flag to only auto-merge updates based on Semantic Versioning.<br />Possible options are: `major, premajor, minor, preminor, patch, prepatch, prerelease, any`.<br /><br />The value of this flag allows for updates for all the matching versions **and lower** with the respect for priority. This means, for example, if the `target` is set to `major` and the update is made to `minor` version the auto-merge will be triggered.<br /><br />For more details on how semantic version difference is calculated please see [semver](https://www.npmjs.com/package/semver) package.<br /><br />If you set a value other than `any`, PRs that are not semantic version compliant are skipped. An example of a non-semantic version is a commit hash when using git submodules. |
32+
| `pr-number` | No | | A pull request number, only required if triggered from a workflow_dispatch event. Typically this would be triggered by a script running in a separate CI provider. See [Trigger action from workflow_dispatch event](#trigger-action-from-workflow_dispatch-event) example. |
33+
| `skip-commit-verification` | No | `false` | If `true`, then the action will not expect the commits to have a verification signature. It is required to set this to `true` in GitHub Enterprise Server. |
34+
| `skip-verification` | No | `false` | If true, the action will not validate the user or the commit verification status |
3535

3636
## Output
3737

38-
| outputs | Description |
38+
| outputs | Description |
3939
|---------------|---------------|
40-
| merge_status | The result status of the merge. It can be one of the following: `approved`, `merged`, `merge_failed`, `skipped:commit_verification_failed`, `skipped:not_a_dependabot_pr`, `skipped:cannot_update_major`, `skipped:bump_higher_than_target`, `skipped:packaged_excluded`|
40+
| merge_status | The result status of the merge. It can be one of the following: `approved`, `merged`, `merge_failed`, `skipped:commit_verification_failed`, `skipped:not_a_dependabot_pr`, `skipped:cannot_update_major`, `skipped:bump_higher_than_target`, `skipped:packaged_excluded` |
4141

4242
## Examples
4343

test/action.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,3 +774,38 @@ tap.test('should forbid when update type is not valid', async () => {
774774
MERGE_STATUS.skippedInvalidVersion
775775
)
776776
})
777+
778+
tap.test('should allow minor when target is major', async () => {
779+
const PR_NUMBER = Math.random()
780+
781+
const { action, stubs } = buildStubbedAction({
782+
payload: {
783+
pull_request: {
784+
number: PR_NUMBER,
785+
user: { login: BOT_NAME },
786+
},
787+
},
788+
inputs: {
789+
PR_NUMBER,
790+
target: 'major',
791+
},
792+
dependabotMetadata: createDependabotMetadata({
793+
updateType: updateTypes.minor,
794+
}),
795+
})
796+
797+
await action()
798+
799+
sinon.assert.calledWithExactly(
800+
stubs.logStub.logInfo,
801+
'Dependabot merge completed'
802+
)
803+
sinon.assert.notCalled(stubs.coreStub.setFailed)
804+
sinon.assert.calledOnce(stubs.approveStub)
805+
sinon.assert.calledOnce(stubs.mergeStub)
806+
sinon.assert.calledWith(
807+
stubs.coreStub.setOutput,
808+
MERGE_STATUS_KEY,
809+
MERGE_STATUS.merged
810+
)
811+
})

0 commit comments

Comments
 (0)