Skip to content

Conversation

memodi
Copy link
Member

@memodi memodi commented Sep 11, 2025

Summary

  • Add automatic "needs-review" labeling for non-draft PRs without WIP in title
  • Add automatic "needs-changes" labeling based on review status
  • Support manual label management via comments

Changes

  • needs-review.yaml: Automatically adds "needs-review" label to non-draft PRs (excludes red-hat-konflux author and WIP titles)

  • needs-changes.yaml: Manages review status labels:

    • Removes "needs-review" when any review is submitted
    • Adds "needs-changes" for non-approved reviews
    • Removes "needs-changes" when "lgtm" label is added
    • Allows manual "needs-changes" labeling via comments
  • I performed self-review of the code changes - Mehul Modi

Test plan

  • Verify workflows trigger correctly on PR events
  • Test label addition/removal based on review states
  • Test manual labeling via comments

🤖 Generated with Claude Code

- Add needs-review workflow: automatically labels non-draft PRs without WIP in title (excludes red-hat-konflux)
- Add needs-changes workflow: manages review status labels based on PR reviews and comments
  - Removes needs-review when any review is submitted
  - Adds needs-changes for non-approved reviews
  - Removes needs-changes when lgtm label is added
  - Allows manual needs-changes labeling via comments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

openshift-ci bot commented Sep 11, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jpinsonneau for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

memodi and others added 2 commits September 11, 2025 15:25
Allow users to manually add needs-review label by commenting "needs-review" or "/needs-review" on PRs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add explicit permissions for issues and pull-requests write access to resolve "Resource not accessible by integration" errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@memodi
Copy link
Member Author

memodi commented Sep 11, 2025

/needs-review

@memodi memodi changed the title Add GitHub workflows for automatic PR labeling Add GitHub workflows for automatic PR labeling for neeeds-review and needs-changes Sep 11, 2025
@memodi
Copy link
Member Author

memodi commented Sep 11, 2025

/hold

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

test

@memodi
Copy link
Member Author

memodi commented Sep 11, 2025

/needs-changes

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

@memodi
Copy link
Member Author

memodi commented Sep 11, 2025

Hi @jotak - I need some help with this, I am always facing 403 error with log, do I need some kind of permissions with new github workflows, based on what I read it should always run with GITHUB_TOKEN:

Error: Unhandled error: HttpError: Resource not accessible by integration

@memodi memodi changed the title Add GitHub workflows for automatic PR labeling for neeeds-review and needs-changes Add GitHub workflows for automatic PR labeling for needs-review and needs-changes Sep 11, 2025
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.22%. Comparing base (20eb307) to head (87313bb).
⚠️ Report is 59 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1974      +/-   ##
==========================================
+ Coverage   71.02%   71.22%   +0.19%     
==========================================
  Files          75       75              
  Lines       10011    10011              
==========================================
+ Hits         7110     7130      +20     
+ Misses       2513     2498      -15     
+ Partials      388      383       -5     
Flag Coverage Δ
unittests 71.22% <ø> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Convert both workflow files to use gh CLI instead of actions/github-script for label management:
- needs-review.yaml: Use gh pr edit for adding/removing needs-review labels
- needs-changes.yaml: Use gh pr edit for managing needs-changes labels based on review state

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-review

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-changes

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

Replace actions/checkout with GH_REPO environment variable to avoid "fatal: not a git repository" errors. This approach matches the existing pr-labels.yaml workflow and is more efficient.

Changes:
- Remove actions/checkout@v4 steps from all jobs
- Replace GITHUB_TOKEN with GH_TOKEN
- Add GH_REPO environment variable for repository context

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-review

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-review

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

@memodi memodi added the needs-review Tells that the PR needs a review label Sep 12, 2025
Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

- Remove restrictive fork condition that was causing steps to be skipped
- Add comprehensive debugging output to diagnose event and condition issues
- Make PR condition more explicit with != null check
- Ensure proper permissions are set on all jobs

This should resolve:
1. needs-changes.yaml steps being skipped
2. needs-review.yaml not executing on "/needs-review" comments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-review

@memodi memodi removed the needs-review Tells that the PR needs a review label Sep 12, 2025
@memodi
Copy link
Member Author

memodi commented Sep 12, 2025

/needs-review

Copy link
Member Author

@memodi memodi left a comment

Choose a reason for hiding this comment

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

/needs-changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant