From f1d151e963f618a0fa4257e591eac1b8ac69c315 Mon Sep 17 00:00:00 2001
From: chris48s <chris48s@users.noreply.github.com>
Date: Tue, 10 Jan 2023 19:39:11 +0000
Subject: [PATCH] migrate danger CI job to GHA (#8477)

* migrate danger CI job to GHA

* constrain triggers

* prettier
---
 .circleci/config.yml         | 33 ---------------------------------
 .github/workflows/danger.yml | 29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 33 deletions(-)
 create mode 100644 .github/workflows/danger.yml

diff --git a/.circleci/config.yml b/.circleci/config.yml
index ea1a430ac4..f0ec6c9712 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -26,26 +26,6 @@ services_steps: &services_steps
         path: junit
 
 jobs:
-  danger:
-    docker:
-      - image: cimg/node:16.15
-    steps:
-      - checkout
-
-      - run:
-          name: Install dependencies
-          command: npm ci
-          environment:
-            CYPRESS_INSTALL_BINARY: 0
-
-      - run:
-          name: Danger
-          when: always
-          environment:
-            # https://github.com/gatsbyjs/gatsby/pull/11555
-            NODE_ENV: test
-          command: npm run danger ci
-
   services:
     docker:
       - image: cimg/node:16.15
@@ -77,13 +57,6 @@ workflows:
               ignore:
                 - master
                 - gh-pages
-      - danger:
-          filters:
-            branches:
-              ignore:
-                - master
-                - gh-pages
-                - /dependabot\/.*/
   # on-commit-with-cache:
   #   jobs:
   #     - npm-install:
@@ -102,9 +75,3 @@ workflows:
   #         filters:
   #           branches:
   #             ignore: master
-  #     - danger:
-  #         requires:
-  #           - npm-install
-  #         filters:
-  #           branches:
-  #             ignore: /dependabot\/.*/
diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml
new file mode 100644
index 0000000000..37fafe4a98
--- /dev/null
+++ b/.github/workflows/danger.yml
@@ -0,0 +1,29 @@
+name: Danger
+on:
+  pull_request_target:
+    types: [opened, edited, reopened, synchronize]
+
+permissions:
+  checks: write
+  pull-requests: write
+  statuses: write
+
+jobs:
+  danger:
+    runs-on: ubuntu-latest
+    if: github.actor != 'dependabot[bot]'
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Setup
+        uses: ./.github/actions/setup
+        with:
+          node-version: 16
+
+      - name: Danger
+        run: npm run danger ci
+        env:
+          # https://github.com/gatsbyjs/gatsby/pull/11555
+          NODE_ENV: test
+          GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
-- 
GitLab