Skip to content

Conversation

@igorjs
Copy link
Owner

@igorjs igorjs commented Nov 3, 2025

Closes #

📑 Description

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

@igorjs igorjs self-assigned this Nov 3, 2025
@igorjs igorjs force-pushed the add-shadow-merge-queue branch 2 times, most recently from 7d8bf66 to 6de675d Compare November 3, 2025 21:06
Signed-off-by: igorjs <oss@mail.igorjs.io>
@igorjs igorjs force-pushed the add-shadow-merge-queue branch from 6de675d to 50a9c02 Compare November 3, 2025 21:10
igorjs added 15 commits November 4, 2025 08:22
- Add GITHUB_TOKEN environment variable to merge-queue.yml workflow
- Change trailingCommas setting in biome.json from 'es5' to 'all'
- Remove trailing commas from string literals in src/index.ts function calls

Signed-off-by: igorjs <oss@mail.igorjs.io>
Adds the issues:write permission to allow the merge queue workflow to
create and update the dashboard issue. This fixes the "Resource not
accessible by integration" error.
- Automatically create mq/* labels on action initialization
- Auto-create dashboard label if missing when creating dashboard issue
- Add initializeLabels() function to create all merge queue labels
- Update dashboard operations to ensure labels exist before use

This eliminates the need for manual label creation and ensures all
required resources are created automatically by the action.

Labels created:
- mq/queued, mq/staging, mq/testing
- mq/conflict, mq/fastlane, mq/hold
- mq/ready, mq/failed
- merge-queue-dashboard (when dashboard is enabled)
- Implement proper issue pinning using GraphQL API
- Add automatic issue locking to prevent user comments
- Lock dashboard issues with 'resolved' reason
- Update README with required permissions documentation
- Add auto-created resources section to docs

Changes:
- Replace commented pinIssue() with working GraphQL implementation
- Add lockIssue() function to lock dashboard conversations
- Add getIssueNodeId() helper for GraphQL operations
- Update both createNewIssue() and updateExistingIssue() to lock
- Document all required permissions (contents, pull-requests, statuses, issues)
- Document auto-created resources (labels, dashboard, state branch)

Fixes:
- Dashboard issue not being pinned
- Dashboard issue conversation not locked
- Change default dashboard_label from "merge-queue-dashboard" to "mq/dashboard"
- Add mq/dashboard to auto-created labels list
- Update workflow configuration to use new label name
- Update README documentation with new label name

This ensures all merge queue labels follow the consistent "mq/*" prefix
pattern for better organization and clarity.
Simplify getLabelsToUse() to just return the dashboard label without
checking/creating it, since initializeLabels() already handles all
label creation at the start of the workflow.

This removes the confusing "Dashboard label not found" info message
that appeared even though the label was being created.

The "No eligible PR found to process" message is intentional and
informational - it just means there are no approved PRs ready to
enter the queue.
Add new github-cli.ts module that wraps gh CLI commands with a type-safe
interface, replacing direct Octokit API calls.

Features:
- Label operations (list, create)
- Issue operations (list, get, create, update, lock, comment, pin)
- PR operations (get, update-branch, merge, GraphQL fetch)
- Git ref operations (get, create, update, delete)
- Repository operations (compare, status, merge)
- Content operations (get, put files)

All functions use @actions/exec to execute gh commands and parse JSON
responses, maintaining compatibility with existing Octokit response
structures where possible.

Savepoint: Core CLI module created, ready for migration.
Replace Octokit label operations with gh CLI:
- initializeLabels() now uses gh.listLabels() and gh.createLabel()
- Remove octokit parameter from initializeLabels()

Savepoint: Label operations migrated.
Replace Octokit issue operations with gh CLI:
- listIssues() for finding existing dashboard
- createIssue() for creating new dashboard
- updateIssue() for updating dashboard body
- lockIssue() for locking conversations
- pinIssue() for pinning dashboard
- Remove octokit parameter from createDashboardOperations()

Savepoint: Dashboard/issue operations migrated.
Replace Octokit git ref operations with gh CLI:
- getBranchSha() uses gh.getRef()
- ensureBranch() uses gh.updateRef() and gh.createRef()
- deleteBranch() uses gh.deleteRef()
- Simplified error handling (404 detection happens in gh module)
- Remove octokit parameter from createBranchOperations()

Savepoint: Branch operations migrated.
Replace Octokit content operations with gh CLI:
- fetchQueueFile() uses gh.getFileContents()
- initializeQueueFile() uses gh.putFileContents()
- writeQueue() uses gh.putFileContents()
- Simplified error handling (no more isOctokitError checks)
- Remove octokit parameter from createQueueOperations()

Savepoint: Queue/content operations migrated.
Final migration changes:
- Replaced all remaining Octokit calls with gh CLI equivalents
- Removed unused octokit variable declarations
- Removed isOctokitError() helper and OctokitError interface
- Simplified getErrorMessage() function
- All PR, repo, and merge operations now use gh CLI

Summary of migration:
- 27 Octokit API calls replaced with gh CLI
- Label ops: gh.listLabels(), gh.createLabel()
- Issue ops: gh.listIssues(), gh.createIssue(), gh.updateIssue(), gh.lockIssue(), gh.pinIssue(), gh.commentOnIssue()
- PR ops: gh.getPullRequest(), gh.updatePullRequestBranch(), gh.mergePullRequest(), gh.fetchOpenPRs()
- Branch ops: gh.getRef(), gh.createRef(), gh.updateRef(), gh.deleteRef()
- Repo ops: gh.compareCommits(), gh.createCommitStatus(), gh.mergeBranches()
- Content ops: gh.getFileContents(), gh.putFileContents()

Kept: @actions/github for github.context.repo only

Savepoint: Complete gh CLI migration.
Built action with complete GitHub CLI integration.
Bundle size increased slightly due to @actions/exec addition.

All Octokit API calls have been replaced with gh CLI commands.
Remove nonsense 【...】 citation references from:
- README.md: removed GitHub docs citations, simplified License/CoC sections
- CODE_OF_CONDUCT.md: removed all citation artifacts, condensed content
- CONTRIBUTING.md: removed citation artifacts, added proper link to CoC
- SECURITY.md: removed GitHub recommendation citation

All documentation is now clean and concise without AI-generated reference artifacts.
- Update workflow to use dynamic branch reference instead of hardcoded main
- Replace GraphQL API calls with direct gh CLI commands for better maintainability
- Remove unused getIssueNodeId function and GraphQLPRNode interface
- Simplify PR fetching logic by using gh pr list instead of custom GraphQL query

Signed-off-by: igorjs <oss@mail.igorjs.io>
igorjs and others added 6 commits November 4, 2025 16:24
…on character escape

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Configure git user email with numeric ID format
- Add signoff to dist folder commit
- Update git config to use numeric user ID in email

Signed-off-by: igorjs <oss@mail.igorjs.io>
…ching

- Remove custom ExecError interface and isExecError helper function
- Directly parse HTTP status codes from error messages in deleteRef and mergeBranches functions
- Add headRefOid to PR data fetching to get commit SHA without separate API call
- Improve error parsing by checking message content directly instead of using custom error types

Signed-off-by: igorjs <oss@mail.igorjs.io>
…ocumentation

- Add comprehensive 'How It Works' section explaining the 6-step merge queue process
- Expand branch protection configuration with rationale for each setting
- Document common use cases including fastlane, auto-update, squash merge, multiple bases, shadow mode, high-frequency processing, and monorepo configurations
- Introduce troubleshooting guide covering queue processing issues, merge conflicts, base movement, stale branches, and dashboard creation problems
- Add new ALGORITHM.md detailing the FIFO queue system, core concepts, and algorithm flow with diagram
- Add new ARCHITECTURE.md documenting the TypeScript implementation, components, data flow, and operation factories
- Add new FAQ.md answering common questions about modes, queue behaviour, configuration, and advanced usage

Signed-off-by: igorjs <oss@mail.igorjs.io>
…ommit threshold

- Change action reference from branch to main
- Switch mode from shadow to live
- Reduce behind_max_commits from 100 to 5

Signed-off-by: igorjs <oss@mail.igorjs.io>
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.

2 participants