Skip to content

Enhance hack/mirror-pr.sh with PR Management Features (Update, List/Close, Dry Run) #2144

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

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Jun 20, 2025

This pull request introduces significant enhancements to the hack/mirror-pr.sh script, improving the workflow for managing mirrored pull requests
used for testing external contributions.

Key features and improvements include:

  • Mirrored PR Listing and Conditional Closing (-c): Added a new option (-c) to list all mirrored pull requests in the repository. The script

image

now fetches the state of the original PR and interactively prompts the user to close the mirrored PR if the original has been merged or closed.

  • Updating Existing Mirrored PRs (-u): Introduced an update mode (-u) that allows selecting an existing mirrored pull request via fzf and
    updating it with the latest changes from the original contributor's branch.

  • Dry Run Mode (-t): Added a dry run option (-t) to the script, enabling users to preview the commands that would be executed without making
    any actual changes. This enhances safety and debuggability.

  • fix: Improve Tekton gitlint step to list all failing commits

chmouel added 3 commits June 20, 2025 14:19
*   Added a dry run mode to the `mirror-pr.sh` script.
*   Introduced the `-t` flag, which allowed users to preview commands prior to
execution.
*   Implemented a `run` helper function to conditionally execute or log
commands.
*   Wrapped all critical commands with the new dry run mechanism, including
`git` and `gh` operations.
*   Updated the script's help message to document the new test mode option.
*   Enhanced script safety and debuggability by offering a non-destructive
verification method.

Signed-off-by: Chmouel Boudjnah <[email protected]>
- Added a new `-u` option to the `mirror-pr.sh` script.
- Allowed users to select an existing mirrored pull request for direct updates.
- Refactored command execution to remove `eval` for improved security.
- Updated command line argument parsing for better maintainability.
- Corrected help message wording and applied consistent quoting.

Signed-off-by: Chmouel Boudjnah <[email protected]>
- Added a new `-c` command line option to `hack/mirror-pr.sh`.
- Implemented functionality to list all mirrored pull requests in the
repository.
- Fetched the state of the original pull request for each mirrored PR.
- Allowed interactive closing of mirrored PRs if their original counterparts
were merged or closed.
- Corrected a formatting issue in the `fzf` interactive selection.

Signed-off-by: Chmouel Boudjnah <[email protected]>
@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 12:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the mirror-pr.sh script by adding new PR management features for mirrored pull requests.

  • Added dry run (-t), update (-u), and list/close (-c) modes for safer and more flexible PR handling.
  • Introduced an interactive prompt to close mirrored PRs when the corresponding original PR is merged or closed.
  • Refactored command executions using the run() helper to support test mode log messages.

@chmouel chmouel force-pushed the mirror-script-more-features branch 2 times, most recently from 97c98de to e8ab27a Compare June 20, 2025 15:46
* Updated the Gitlint invocation method within the Tekton pipeline script.
* Changed the commit linting check to collect all non-compliant commit hashes.
* Modified the step to output a list of every commit that failed the linting
check before exiting.
* Provided clearer feedback to developers by identifying all commits needing
correction.

Signed-off-by: Chmouel Boudjnah <[email protected]>
@chmouel chmouel force-pushed the mirror-script-more-features branch from e8ab27a to 1e50579 Compare June 20, 2025 15:48
Copy link
Contributor

@zakisk zakisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@zakisk zakisk merged commit 6575e4d into openshift-pipelines:main Jun 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants