Skip to content

feat: Support push and merge_group events with use_rest_api #2835

@npwolf

Description

@npwolf

Problem

When use_rest_api: true is set, only pull_request* events are supported. For push, merge_group, and all other events, actions/checkout is required. For large repositories, the checkout step adds significant time to workflows that only need to know which files changed (e.g., conditional job triggers, path-based filtering).

This also creates a poor user experience for teams using merge queues. A workflow with use_rest_api: true works correctly on pull_request events, but then fails when the same workflow triggers on merge_group as the PR moves into the merge queue — or on push when it lands on the target branch. Users either have to add actions/checkout (losing the performance benefit) or maintain separate workflow configurations per event type.

Proposed solution

Extend the REST API mode to support push and merge_group events by using the repos.compareCommits endpoint instead of pulls.listFiles. The webhook payload already contains the necessary SHAs:

  • push: payload.before / payload.after
  • merge_group: payload.merge_group.base_sha / payload.merge_group.head_sha

Both endpoints return files in the same shape (filename, status, previous_filename), so all downstream processing (filtering, dir_names, output formatting, etc.) works without changes.

Prior art

This pattern is proven in the wild. Two maintained forks of jitterbit/get-changed-files use repos.compareCommits for API-only changed file detection across event types, with no checkout required:

Scope

  • getChangedFilesFromGithubAPI in changedFiles.ts — branch endpoint selection by event type
  • Gate in main.ts — allow push/merge_group through to the REST API path
  • Unit tests for both the API function and routing logic
  • No changes to the git-based code path or any existing inputs/outputs

Limitations

The same 3,000-file cap that applies to pulls.listFiles also applies to repos.compareCommits. This is a GitHub API limitation, not specific to this implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions