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

feat(bitbucket): support task autocomplete #30901

Merged

Conversation

dandandy
Copy link
Contributor

Changes

Add a new renovate option 'bbAutoResolvePrTasks' which when set to true (the default is false) will mark PR tasks as "resolved" after the PR is created. This only works in bitbucket cloud.

Context

Closes #27485 (reply in thread)

This feature is useful for repos which set default tasks because it:

  • saves reviewers from having to click on the checkbox to manually resolves tasks
  • unblocks automerging (currently automerge fails if there are unresolved tasks)

Documentation (please check one with an [x])

  • [ x ] I have updated the documentation

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • [ x ] No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

I plan to add unit tests, but I wanted to raise this first to get any inital feedback before I write tests (as per your contribution docs).

@CLAassistant
Copy link

CLAassistant commented Aug 20, 2024

CLA assistant check
All committers have signed the CLA.

@dandandy
Copy link
Contributor Author

dandandy commented Aug 20, 2024

Here is an excerpt from the DEBUG logs when I ran it locally against my branch with config:

renovate.json file

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:base"
  ],
  "automerge": true,
  "automergeType": "pr",
  "rangeStrategy": "bump",
  "bbAutoResolvePrTasks": true,
  "branchConcurrentLimit": 1,
  "prHourlyLimit": 0
}

run command:

LOG_LEVEL=debug RENOVATE_CONFIG_FILE=config.js node  ../renovate/dist/renovate.js

config.js

module.exports = {
    endpoint: 'https://api.bitbucket.org/',
      repositories: ['testing-dbarrett/testing-repo'],
    platform: 'bitbucket',
    username: '***redacted***'
}
DEBUG: Creating PR (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "prTitle": "Update dependency react-scripts to ^3.4.4"
DEBUG: Creating PR (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "title": "Update dependency react-scripts to ^3.4.4",
       "base": "main"
DEBUG: Using queue: host=api.bitbucket.org, concurrency=16 (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
DEBUG: Auto resolve PR tasks (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "title": "Update dependency react-scripts to ^3.4.4",
       "base": "main",
       "bbAutoResolvePrTasks": true
DEBUG: List PR tasks (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "title": "Update dependency react-scripts to ^3.4.4",
       "base": "main",
       "bbAutoCompleteTasks": true,
       "listTaskRes": [
         {
           "id": 32224203,
           "state": "UNRESOLVED",
           "content": "[content]",
           "creator": null,
           "created_on": "2024-08-20T01:42:20.646432+00:00",
           "updated_on": "2024-08-20T01:42:20.646497+00:00",
           "resolved_on": null,
           "resolved_by": null,
           "pending": false,
           "links": {
             "self": {
               "href": "https://api.bitbucket.org/2.0/repositories/testing-dbarrett/testing-repo/pullrequests/14/tasks/32224203"
             },
             "html": {
               "href": "https://bitbucket.org/testing-dbarrett/testing-repo/pull-requests/14/_/diff#task-32224203"
             }
           }
         }
       ]
DEBUG: Put PR tasks - mark resolved (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "title": "Update dependency react-scripts to ^3.4.4",
       "base": "main",
       "updateTaskResponse": {
         "statusCode": 200,
         "body": {
           "id": 32224203,
           "state": "RESOLVED",
           "content": "[content]",
           "creator": null,
           "created_on": "2024-08-20T01:42:20.646432+00:00",
           "updated_on": "2024-08-20T01:42:21.658921+00:00",
           "resolved_on": "2024-08-20T01:42:21.658916+00:00",
           "resolved_by": {
             "display_name": "Daniel Barrett",
             "links": {
               "self": {
                 "href": "https://api.bitbucket.org/2.0/users/%7Be0356302-f882-4657-bf0e-63fa22579be3%7D"
               },
               "avatar": {
                 "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/initials/DB-1.png"
               },
               "html": {
                 "href": "https://bitbucket.org/%7Be0356302-f882-4657-bf0e-63fa22579be3%7D/"
               }
             },
             "type": "user",
             "uuid": "{e0356302-f882-4657-bf0e-63fa22579be3}",
             "account_id": "70121:29895d36-501b-4744-93ed-25484d8556a6",
             "nickname": "Daniel Barrett"
           },
           "pending": false,
           "links": {
             "self": {
               "href": "https://api.bitbucket.org/2.0/repositories/testing-dbarrett/testing-repo/pullrequests/14/tasks/32224203"
             },
             "html": {
               "href": "https://bitbucket.org/testing-dbarrett/testing-repo/pull-requests/14/_/diff#task-32224203"
             }
           }
         },
         "headers": {
           "date": "Tue, 20 Aug 2024 01:42:21 GMT",
           "content-type": "application/json; charset=utf-8",
           "server": "AtlassianEdge",
           "vary": "Authorization, Origin, cookie, user-context",
           "x-accepted-oauth-scopes": "pullrequest",
           "x-used-mesh": "False",
           "x-credential-type": "apppassword",
           "x-token-id": "4741201",
           "x-oauth-scopes": "issue:write, pullrequest:write, team, account",
           "x-view-name": "bitbucket.apps.pullrequests.api.v20.handlers.PullRequestTaskHandler",
           "x-dc-location": "Micros-3",
           "x-served-by": "e1428dd1c9ea",
           "x-version": "19e939a229ff",
           "x-static-version": "19e939a229ff",
           "x-request-count": "200",
           "x-render-time": "0.22031736373901367",
           "x-b3-traceid": "f312c246e5b74aa5841846f0c1eb430a",
           "x-b3-spanid": "1b21104d5cb763ec",
           "x-frame-options": "SAMEORIGIN",
           "expires": "Tue, 20 Aug 2024 01:42:21 GMT",
           "cache-control": "max-age=0, no-cache, no-store, must-revalidate, private",
           "x-usage-user-time": "0.112488",
           "x-usage-system-time": "0.005170",
           "x-usage-input-ops": "0",
           "x-usage-output-ops": "0",
           "x-trace-id": "f312c246e5b74aa5841846f0c1eb430a",
           "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
           "content-encoding": "gzip",
           "x-content-type-options": "nosniff",
           "x-xss-protection": "1; mode=block",
           "atl-traceid": "f312c246e5b74aa5841846f0c1eb430a",
           "report-to": "{\"endpoints\": [{\"url\": \"https://dz8aopenkvv6s.cloudfront.net\"}], \"group\": \"endpoint-1\", \"include_subdomains\": true, \"max_age\": 600}",
           "nel": "{\"failure_fraction\": 0.001, \"include_subdomains\": true, \"max_age\": 600, \"report_to\": \"endpoint-1\"}",
           "transfer-encoding": "chunked"
         },
         "authorization": "***********"
       }
 INFO: PR created (repository=testing-dbarrett/testing-repo, branch=renovate/react-scripts-3.x)
       "pr": 14,
       "prTitle": "Update dependency react-scripts to ^3.4.4"

@dandandy dandandy marked this pull request as draft August 20, 2024 05:47
@dandandy dandandy changed the title Feat/27485 bitbucket task autocomplete feat(bitbucket auto resolve task): 27485 bitbucket task autocomplete Aug 20, 2024
@dandandy dandandy changed the title feat(bitbucket auto resolve task): 27485 bitbucket task autocomplete feat(bitbucket): 27485 bitbucket task autocomplete Aug 20, 2024
@rarkins
Copy link
Collaborator

rarkins commented Aug 20, 2024

@dandandy please complete the CLA and mark as ready for review when you want us to look at it

@dandandy dandandy marked this pull request as ready for review August 21, 2024 00:10
@dandandy dandandy force-pushed the feat/27485-bitbucket-task-autocomplete branch from 3484689 to 807acde Compare August 21, 2024 00:24
@viceice viceice changed the title feat(bitbucket): 27485 bitbucket task autocomplete feat(bitbucket): support task autocomplete Aug 21, 2024
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
@dandandy dandandy force-pushed the feat/27485-bitbucket-task-autocomplete branch from c9f0a2b to 722a2b7 Compare August 25, 2024 13:47
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/types.ts Outdated Show resolved Hide resolved
@dandandy
Copy link
Contributor Author

dandandy commented Sep 6, 2024

Hey @viceice is there anything else you would like me to do for this PR?

I understand if you're waiting for the right time to merge this in for a release. checking in just in case 😀

Thanks!

lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/schema.ts Outdated Show resolved Hide resolved
auto-merge was automatically disabled September 6, 2024 20:06

Head branch was pushed to by a user without write access

@dandandy
Copy link
Contributor Author

dandandy commented Sep 6, 2024

hey @viceice @rarkins this pr is ready to be reviewed again.

@rarkins
Copy link
Collaborator

rarkins commented Sep 7, 2024

Please just use the "Request reviewers" UI in github only instead of @ mentions otherwise we get too many notifications

@dandandy
Copy link
Contributor Author

Please just use the "Request reviewers" UI in github only instead of @ mentions otherwise we get too many notifications

Sorry about that!

@dandandy
Copy link
Contributor Author

Hello, just checking if there's anything else you need from me for this PR? Thanks!

@rarkins rarkins added this pull request to the merge queue Sep 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 21, 2024
@rarkins rarkins added this pull request to the merge queue Sep 21, 2024
Merged via the queue into renovatebot:main with commit 07169cd Sep 21, 2024
38 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 38.93.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

5 participants