Skip to content

[DX-4969] Handle merge_group events - #1634

Merged
kalverra merged 10 commits into
mainfrom
dx-4969/fixMergeQueue
Aug 12, 2026
Merged

[DX-4969] Handle merge_group events#1634
kalverra merged 10 commits into
mainfrom
dx-4969/fixMergeQueue

Conversation

@kalverra

@kalverra kalverra commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

merge_group events had issues with git history, as we didn't fetch the proper git history. The git pull fallback didn't work properly either. Now we fetch proper history with the API.

Tested on smartcontractkit/chainlink#23386

merge_group events had issues with git history as we didn't fetch
proper git history.
@kalverra
kalverra requested a review from a team as a code owner August 11, 2026 16:48
@github-actions

Copy link
Copy Markdown
Contributor

👋 kalverra, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦋 Changeset is good to go

Latest commit: 63643d9

We got this.

Not sure what this means? Click here to learn what changesets are.

@kalverra
kalverra requested review from erikburt and a lite review from Copilot August 11, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the advanced-triggers action to handle merge_group events more reliably by switching to GitHub API-based file change detection (with git-based fallbacks) and improving how missing git refs are fetched when diffs require additional history.

Changes:

  • Add merge_group changed-file detection via repos.compareCommits and route it through getChangedFiles(...).
  • Replace the prior git pull fallback with a shallow git fetch of missing refs (optionally authenticated).
  • Add Vitest coverage for the new routing and helper behavior, plus a changeset for a patch release.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates lockfile metadata for the workspace.
actions/advanced-triggers/src/run.ts Routes merge_group changed-file detection through API with git fallback; threads token through git paths.
actions/advanced-triggers/src/github.ts Adds getChangedFilesForMergeGroup using repos.compareCommits.
actions/advanced-triggers/src/git.ts Replaces git pull fallback with shallow fetch of missing refs; supports authenticated fetch.
actions/advanced-triggers/src/tests/run.test.ts Adds routing tests for merge_group and verifies fallback behavior.
actions/advanced-triggers/src/tests/github.test.ts Adds tests for merge-group file extraction from API responses.
actions/advanced-triggers/src/tests/git.test.ts Adds tests for shallow-fetch fallback behavior in git diff path.
actions/advanced-triggers/dist/index.js Updates the bundled action output to match source changes.
.changeset/sweet-horns-bite.md Declares a patch release for advanced-triggers.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/advanced-triggers/src/github.ts Outdated
Comment thread actions/advanced-triggers/src/__tests__/github.test.ts Outdated
Comment thread actions/advanced-triggers/src/git.ts Outdated
@kalverra kalverra changed the title fix(advanced-triggers): handle merge_group events [DX-4969] Handle merge_group events Aug 11, 2026
@kalverra
kalverra enabled auto-merge (squash) August 11, 2026 18:29
Comment thread actions/advanced-triggers/src/github.ts Outdated
Comment thread actions/advanced-triggers/src/github.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Suppressed comments (1)

actions/advanced-triggers/src/run.ts:214

  • The merge_group changed-file strategy now uses the GitHub API (compareCommits) with a git fallback, but the action documentation still states that merge_group uses git diff --name-only (see actions/advanced-triggers/README.md table under “Supported events”). This mismatch can mislead workflow authors troubleshooting behavior and required permissions.
    case "merge_group": {
      return getChangedFilesForMergeGroupWithFallback(
        octokit,
        owner,
        repo,
        event.base,
        event.head,
        repositoryRoot,
        token,
      );
    }

Switch from octokit.paginate() to a direct REST call for merge group
comparisons. The paginated approach masked the API's hard 300-file cap,
which returns truncated results without pagination links instead of
fetching all pages.
Add a hook to run pnpm build:artifacts when package.json is staged.
This ensures build artifacts are generated automatically when the
package configuration changes.
@kalverra
kalverra merged commit 1bb42c1 into main Aug 12, 2026
19 checks passed
@kalverra
kalverra deleted the dx-4969/fixMergeQueue branch August 12, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants