Skip to content

Conversation

@MitaliBhalla
Copy link
Contributor

fix: resolve dependabot auto-merge workflow issues

  • Remove invalid 'metadata: read' permission that causes GitHub Actions validation error
  • Fix auto-merge API endpoint to use correct format with auto_merge parameter
  • Improve label checking logic to be more permissive for Dependabot PRs
  • Replace gh CLI commands with curl for better compatibility and consistency
  • Ensure workflow only runs on upstream repository to prevent fork failures

Fixes auto-merge functionality for Dependabot PRs and resolves workflow validation errors.

What type of PR is this?

  • fix (Bug Fix)
  • feat (New Feature)
  • docs (Documentation)
  • test (Test Coverage)
  • chore (Clean Up / Maintenance Tasks)
  • other (Anything that doesn't fit the above)

What this PR does / Why we need it?

This PR fixes critical issues in the Dependabot auto-merge workflow that were preventing automatic merging of dependency updates:

  1. Resolves GitHub Actions validation error - Removes the invalid metadata: read permission that was causing workflow validation failures
  2. Fixes auto-merge API usage - Corrects the GitHub API endpoint to use the proper auto-merge format instead of immediate merge
  3. Improves dependency detection - Makes label checking more permissive to handle various Dependabot PR label configurations
  4. Ensures compatibility - Replaces gh CLI commands with curl for better runner compatibility
  5. Prevents fork failures - Workflow is already configured to only run on the upstream repository

These fixes will enable automatic merging of patch and minor version dependency updates while requiring manual review for major version updates.

Which Jira/Github issue(s) does this PR fix?

  • Fixes Dependabot auto-merge workflow validation and functionality issues

Special notes for your reviewer

  • The workflow now uses the correct GitHub API endpoint for enabling auto-merge (/pulls/{pull_number} with auto_merge parameter)
  • Label checking is more flexible - accepts area/dependency, dependencies, or any PR from dependabot[bot]
  • All API calls use curl for consistency and better error handling
  • The workflow will only execute on the upstream repository, preventing unnecessary runs on forks

Unit Test Coverage

Test coverage checks

  • Added unit tests
  • Created jira card to add unit test
  • This PR may not need unit tests

This PR modifies GitHub Actions workflow configuration only - no application code changes that would require unit tests.

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR
  • Backward compatible

Workflow changes are backward compatible and will improve existing Dependabot PR handling.

/label tide/merge-method-squash

- Remove invalid 'metadata: read' permission that causes GitHub Actions validation error
- Fix auto-merge API endpoint to use correct format with auto_merge parameter
- Improve label checking logic to be more permissive for Dependabot PRs
- Replace gh CLI commands with curl for better compatibility and consistency
- Ensure workflow only runs on upstream repository to prevent fork failures

Fixes auto-merge functionality for Dependabot PRs and resolves workflow validation errors.
@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jan 28, 2026
@openshift-ci openshift-ci bot requested review from a7vicky and bmeng January 28, 2026 13:40
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 28, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MitaliBhalla

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 28, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 28, 2026

@MitaliBhalla: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.91%. Comparing base (21b161e) to head (6cd8031).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #885   +/-   ##
=======================================
  Coverage   52.91%   52.91%           
=======================================
  Files          86       86           
  Lines        6525     6525           
=======================================
  Hits         3453     3453           
  Misses       2610     2610           
  Partials      462      462           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge" \
-d '{"merge_method":"merge"}')
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you ever successfully used auto-merge for a PR before, but found it unstable or not working in certain scenarios?

Can see you use the GitHub REST API, I'm not sure whether auto-merge is actually supported. I found this discussion (https://github.com/orgs/community/discussions/24719
), and a recent reply in 2025 suggests it’s still unavailable?

-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
-d '{"body":"🚨 **Major Version Update Detected** 🚨\n\nThis PR contains a major version update that requires manual review:\n- **Dependency:** ${{ steps.metadata.outputs.dependency-names }}\n- **Previous version:** ${{ steps.metadata.outputs.previous-version }}\n- **New version:** ${{ steps.metadata.outputs.new-version }}\n\nPlease review the changelog and breaking changes before merging.\n\nAuto-merge has been **disabled** for this PR."}'
Copy link
Contributor

Choose a reason for hiding this comment

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

If dependency name contains " or special characters, it can break JSON structure, may be better to use jq for better handle any JSON Escaping.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants