Hi! I am trying to enable CI Settings in the Merge...
# how-do-i
m
Hi! I am trying to enable CI Settings in the Merge Queue. I've added the Graphite app as a bypass in my rulesets (NOT classic branch protection), and the automatic check then won't pass and allow me to enable CI Settings. Okay, I think, that means I need a classic branch protection... but, the dialog is very confusing in that case: "Add this via classic branch protection rule or as a ruleset in GitHub and try again. Note: if you choose to use a ruleset, Graphite will not be able to validate your configuration." I chose a ruleset. Graphite can't validate. Thus I cannot turn it on? 🙂 Thanks!
g
hey Mads, yeah you'll need to temporarily enable a classic branch protection, then you'll be able to enable the CI Settings and once saved in Graphite you can disable the classic branch protection.
👍 1
m
Thanks!
Followup - since it seems queued PRs get closed instead of merged, I need Linear to still treat them as merged. Linear's docs say it looks for an
externally-merged
label on the PR before it's closed. Does Graphite do that automatically, or do I need to set that up somwhre?
g
you'd need to set it up. You could have an Automation apply it to all PRs by default, otherwise a user shared this GitHub Action workflow that has some sophisticated logic:
Copy code
name: Linear - mark externally-merged when queued in Graphite

on:
  issue_comment:
    types: [created]

permissions: {}

jobs:
  label-externally-merged:
    permissions:
      pull-requests: write # Required to add labels to PRs
    steps:
      - name: Add externally-merged label
        uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            if (!context.payload.issue.pull_request) return;

            const commentAuthor = context.payload.comment.user.login;
            if (commentAuthor !== 'graphite-app[bot]') return;

            const comment = context.payload.comment.body;
            const queuePhrase = 'added this pull request to the [Graphite merge queue]';
            if (!comment.includes(queuePhrase)) return;

            const prNumber = context.payload.issue.number;

            await github.rest.issues.addLabels({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: prNumber,
              labels: ['externally-merged']
            });
👍 1
m
Thanks