[llvm] [Github][RFC] Add workflow to diff codegen on llvm-test-suite (PR #190010)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 07:06:00 PDT 2026


================
@@ -0,0 +1,136 @@
+# When /test-suite is commented on a PR, checks out the PR, builds clang and
+# then the test-suite in several configurations. It then checks out the base of
+# the PR, builds clang and the test-suite again, and then uploads the diff of
+# the codegen.
+
+name: Diff test-suite codegen
+
+on:
+  issue_comment:
+    types:
+      - created
+
+jobs:
+  test-suite:
+    name: Build and diff
+    runs-on: ubuntu-24.04
+    permissions:
+      pull-requests: write
+    if: >-
+      !startswith(github.event.comment.body, '<!--IGNORE-->') &&
+      github.event.issue.pull_request && contains(github.event.comment.body, '/test-suite')
+    steps:
+      - name: Get pull request
+        id: get-pr
+        uses: actions/github-script at ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
+        with:
+          script: |
+            const { data: pr } = await github.rest.pulls.get({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              pull_number: context.payload.issue.number
+            })
+            if (!pr.mergeable)
+              await github.rest.issues.createComment({
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                body: "Can't diff PR, PR isn't mergeable"
+              })
+            return pr
+      - name: Check pull request is mergeable
+        if: ${{ !fromJSON(steps.get-pr.outputs.result).mergeable }}
+        run: exit 1
+      - name: Thumbs up comment
+        uses: actions/github-script at ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
+        with:
+          script: |
+            github.rest.reactions.createForIssueComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              comment_id: context.payload.comment.id,
+              content: '+1'
+            })
+      - name: Checkout pull request
+        uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+        with:
----------------
lukel97 wrote:

I think the `pull_request` event trigger uses the PR's fork or and ref as the default options, but this workflow uses `issue_comment` which will default to the upstream repo llvm/llvm-project and default branch: https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#issue_comment

That's why we need to fetch the PR details manually with the JS API above. I was a bit surprised it was this fiddly

https://github.com/llvm/llvm-project/pull/190010


More information about the llvm-commits mailing list