Clean up stale Bitbucket steps when switching to pre-commit#1293
Closed
Clean up stale Bitbucket steps when switching to pre-commit#1293
Conversation
Co-authored-by: nathanjmcdougall <[email protected]>
Copilot
AI
changed the title
[WIP] Fix issue with stale Bitbucket steps in CI
Clean up stale Bitbucket steps when switching to pre-commit
Feb 10, 2026
nathanjmcdougall
requested changes
Feb 10, 2026
src/usethis/_tool/base.py
Outdated
| # don't add Bitbucket steps (the tool will run via pre-commit instead) | ||
| if is_pre_commit_used(): | ||
| # Remove any stale Bitbucket steps before returning | ||
| if is_bitbucket_used(): |
Collaborator
There was a problem hiding this comment.
@copilot this doesn't make sense to me - won't this introduce a bug where we remove steps even when they don't need to be removed?
Contributor
Author
There was a problem hiding this comment.
You're absolutely right! The original code would remove steps even when the tool wasn't being used, which is incorrect.
Fixed in 54dab02 by adding self.is_used() check. Now steps are only removed when:
- Pre-commit is enabled
- Bitbucket is used
- The tool is actually configured/used in the project
Also added a test to verify steps are NOT removed when the tool isn't used.
Co-authored-by: nathanjmcdougall <[email protected]>
Collaborator
|
:\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan to Fix Stale Bitbucket Steps Issue
Problem:
Tool.update_bitbucket_steps()returns early whenis_pre_commit_used()is true (line 683-684), which prevents cleanup of previously-added Bitbucket steps. This leaves stale steps inbitbucket-pipelines.ymlafter switching to pre-commit.Solution: Before returning early when pre-commit is used, remove any managed Bitbucket steps for this tool.
Checklist:
update_bitbucket_steps()Tool.update_bitbucket_steps()remove_bitbucket_steps()when pre-commit is used before returningself.is_used()to prevent removing steps for unused toolsSecurity Summary
No security vulnerabilities were discovered during analysis.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.