fix(ci): add checkout step to auto-approve-bot-prs workflow - #3717
Merged
Conversation
The gh CLI commands were failing because the repository wasn't checked out. Added actions/checkout@v4 step to ensure git context is available.
Using pull_request_target instead of pull_request allows the workflow to run with write permissions even for PRs from forks or bot accounts. This is necessary for adding labels and approving PRs.
…ssion - Change trigger from pull_request to pull_request_target for proper permissions - Add issues:write permission required for label management - Add --repo flag to gh commands for explicit repository context - Remove checkout step (not needed with pull_request_target) - Fixes GraphQL: Resource not accessible by integration error
- Add push trigger on fix/auto-approve-bot branch for immediate testing - Handle both push and pull_request_target events in workflow logic - Add logging step for push events to show eligibility check results - Only run label/approve actions on actual PR events
- Remove all testing code (push triggers, test PR numbers, debug logging) - Simplify workflow to only run on pull_request_target events - Only run for rhdh-bot PRs - Keep fix/auto-approve-bot pattern for final testing before merge - Ready for production deployment
- Remove temporary polasudo testing allowance - Remove fix/auto-approve-bot test pattern - Clean, production-ready workflow for rhdh-bot PRs - Ready to merge and deploy
…t repository error - Adds actions/checkout@v4 to provide git context for gh CLI commands - Fixes 'fatal: not a git repository' error in auto-approve workflow
Contributor
|
The image is available at: |
Contributor
|
The image is available at: |
Contributor
|
The image is available at: |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nickboldt The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fortune-Ndlovu
pushed a commit
to Fortune-Ndlovu/rhdh
that referenced
this pull request
Dec 1, 2025
…eveloper#3717) * fix(auto-approve): add checkout step to fix 'not a git repository' error The gh CLI commands were failing because the repository wasn't checked out. Added actions/checkout@v4 step to ensure git context is available. * test: temporarily enable workflow for polasudo to test functionality * test: add fix/auto-approve-bot to eligible patterns for testing * fix(auto-approve): add issues:write permission for label management * fix(auto-approve): use pull_request_target for proper permissions Using pull_request_target instead of pull_request allows the workflow to run with write permissions even for PRs from forks or bot accounts. This is necessary for adding labels and approving PRs. * Fix auto-approve workflow: use REST API for adding labels instead of gh CLI * test: trigger workflow re-run * test: remove trigger file * test: temporarily disable user condition to test workflow * fix(auto-approve): use pull_request_target and add issues:write permission - Change trigger from pull_request to pull_request_target for proper permissions - Add issues:write permission required for label management - Add --repo flag to gh commands for explicit repository context - Remove checkout step (not needed with pull_request_target) - Fixes GraphQL: Resource not accessible by integration error * fix(auto-approve): add fix/auto-approve-bot pattern for testing * feat(auto-approve): add push trigger for faster testing feedback - Add push trigger on fix/auto-approve-bot branch for immediate testing - Handle both push and pull_request_target events in workflow logic - Add logging step for push events to show eligibility check results - Only run label/approve actions on actual PR events * test: trigger workflow rerun * test: simplify push logging to debug workflow triggering * test: add temporary PR labeling simulation for fork testing * test: enable real PR labeling on push events for testing * test: target PR redhat-developer#1 in fork for labeling test * test: target PR redhat-developer#2 for labeling demonstration * feat: clean up auto-approve workflow for production use - Remove all testing code (push triggers, test PR numbers, debug logging) - Simplify workflow to only run on pull_request_target events - Only run for rhdh-bot PRs - Keep fix/auto-approve-bot pattern for final testing before merge - Ready for production deployment * test: temporarily allow polasudo for final workflow testing * feat: finalize auto-approve workflow for production - Remove temporary polasudo testing allowance - Remove fix/auto-approve-bot test pattern - Clean, production-ready workflow for rhdh-bot PRs - Ready to merge and deploy * test: trigger workflow to demonstrate PR redhat-developer#2 labeling * Delete test-workflow-final.md * chore: reorganize auto-approve workflow flags for better readability * fix(ci): add checkout step to auto-approve-bot-prs workflow to fix git repository error - Adds actions/checkout@v4 to provide git context for gh CLI commands - Fixes 'fatal: not a git repository' error in auto-approve workflow Assisted-by: Cursor Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
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.
Fixes the 'fatal: not a git repository' error in the auto-approve workflow by adding the missing actions/checkout@v4 step.
Changes:
Issue:
The workflow was failing with 'fatal: not a git repository' because gh commands require a git repository context.
Solution:
Added actions/checkout@v4 as the first step in the workflow to provide the necessary git context.