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

Update draft PR control #912

Merged
merged 6 commits into from
Jan 19, 2024
Merged

Update draft PR control #912

merged 6 commits into from
Jan 19, 2024

Conversation

godrei
Copy link
Contributor

@godrei godrei commented Jan 19, 2024

Checklist

Version

Requires a PATCH version update

Context

This PR fixes an issue with the previously introduced draft PR trigger control.

The previous implementation couldn't handle properly when a draft PR is converted to a ready-for-review status.

The new implementation compares PR trigger map items to a PR readiness status with three possible values: draft, ready_for_review and converted_to_ready_for_review this way:

If the draft PR trigger is enabled:

  • build params with pull_request_ready_state=draft → trigger a build
  • build params with pull_request_ready_state=ready_for_review → trigger a build
  • build params with pull_request_ready_state=converted_to_ready_for_review → skip build (only the ready state has changed, build was already running on this state of the code)

If the draft PR trigger is disabled:

  • build params with pull_request_ready_state=draft → skip a build
  • build params with pull_request_ready_state=ready_for_review → trigger a build
  • build params with pull_request_ready_state=converted_to_ready_for_review → trigger a build (state changed to ready to review)

The new comparison is aligned with the related webhook service changes: bitrise-io/bitrise-webhooks#158

Changes

  • Update TriggerMapItemModel.MatchWithParams based on the above-explained matching logic
  • The trigger and trigger-check commands' --draft-pr flag was replaced by the pr-ready-state flag
  • The RunAndTriggerParamsModels draft-pr property was replaced by the PRReadyState property

godrei and others added 6 commits January 19, 2024 10:57
* update draft pr trigger check param

* updated tests

* updated trigger options help text

* cleanup

* updated tests

* updated tests

* tests updated
@godrei godrei marked this pull request as ready for review January 19, 2024 14:45
@godrei godrei merged commit 585c90c into master Jan 19, 2024
5 checks passed
@godrei godrei deleted the pr-ready-state branch January 19, 2024 15:19
@godrei godrei mentioned this pull request Jan 19, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants