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: add prow like PR management #1903

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Feb 3, 2025

This add a Pac PipelineRun that enables managing PRs through
GitHub comments, replacing Prow-like commands with Pipelines as Code.

  • /assign user1 user2 → Assign users to a PR.

  • /unassign user1 user2 → Remove assigned users from a PR.

  • /label bug enhancement → Add labels to a PR.

  • /unlabel bug → Remove specific labels from a PR.

  • /help → Posts a comment listing all supported commands in a markdown table.

  • Uses embedded Python in a Tekton Task to interact with the GitHub API.

  • Extracts GitHub token from git_auth_secret for authentication.

  • Parses {{ trigger_comment }} to determine the appropriate action.

  • Handles API errors with proper logging and graceful failures.

  • Supports both POST and DELETE requests for GitHub issue APIs.

Signed-off-by: Chmouel Boudjnah chmouel@redhat.com

@chmouel
Copy link
Member Author

chmouel commented Feb 3, 2025

/assign zakisk

@chmouel
Copy link
Member Author

chmouel commented Feb 3, 2025

/label feature

@pipelines-as-code pipelines-as-code bot added the feature New feature or request label Feb 3, 2025
@chmouel
Copy link
Member Author

chmouel commented Feb 3, 2025

/help

Copy link

🤖 Available Commands

Command Description
/assign user1 user2 Assigns users to the PR
/unassign user1 user2 Removes assigned users
/label bug feature Adds labels to the PR
/unlabel bug feature Removes labels from the PR
/help Shows this help message

@chmouel chmouel force-pushed the prow-pr branch 2 times, most recently from b9ffa36 to a215330 Compare February 3, 2025 09:46
@chmouel
Copy link
Member Author

chmouel commented Feb 3, 2025

/lgtm

Copy link

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

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

LGTM 👍

This add a Pac PipelineRun that enables managing PRs through
GitHub comments, replacing Prow-like commands with Pipelines as Code.

- `/assign user1 user2` → Assign users to a PR.
- `/unassign user1 user2` → Remove assigned users from a PR.
- `/label bug enhancement` → Add labels to a PR.
- `/unlabel bug` → Remove specific labels from a PR.
- `/lgtm` → Approve a PR with a comment.
- `/help` → Posts a comment listing all supported commands in a markdown table.

- Uses embedded Python in a Tekton Task to interact with the GitHub API.
- Extracts GitHub token from `git_auth_secret` for authentication.
- Parses `{{ trigger_comment }}` to determine the appropriate action.
- Handles API errors with proper logging and graceful failures.
- Supports both `POST` and `DELETE` requests for GitHub issue APIs.

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@zakisk
Copy link
Contributor

zakisk commented Feb 3, 2025

@chmouel it would be better if LGTM comment by bot should be like this:
jenkins-x/go-scm#477 (comment)

@chmouel
Copy link
Member Author

chmouel commented Feb 3, 2025

removed the /lgtm since it's the bot (the owner of the token) that does it not the actual user, there is no way to do this properly i think, unless we implemente a full blown implementation of how prow does it, counting a minimal of /lgtm on a pr from approved users to approve the PR, but that is something for another time for someone else

@zakisk ^^

@chmouel chmouel merged commit 8e9de1c into openshift-pipelines:main Feb 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants