Hey <@U08V38CHH5Y> Adding `externally-merged` la...
# how-do-i
c
Hey @Gareth Brickman Adding
externally-merged
label to the PR before merging worked. I wrote a GH Actions script and we were able to automate this, and the Linear auto-transition is fixed now:
Copy code
name: Linear - mark externally-merged when queued in Graphite

on:
  issue_comment:
    types: [created]

permissions:
  pull-requests: write

jobs:
  label:
    runs-on: ubuntu-latest
    steps:
      - name: Add externally-merged label
        uses: actions/github-script@v7
        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']
            });
It's not the most robust way of handling it since it could break if the queuePhrase changes, but it works for now at least.
p
awesome, thanks for sharing!
👍 1
c
You're welcome, hope this helps if it comes up with any other customers on your end.