From 4ab0cfca9c9f4a455360cf3cfca9395d58e98674 Mon Sep 17 00:00:00 2001
From: Roman Abdulmanov <roman@metabase.com>
Date: Tue, 18 Jun 2024 12:44:13 +0100
Subject: [PATCH] Mark external PRs with the label (#44343)

---
 .github/workflows/external-pr-label.yml | 28 +++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 .github/workflows/external-pr-label.yml

diff --git a/.github/workflows/external-pr-label.yml b/.github/workflows/external-pr-label.yml
new file mode 100644
index 00000000000..4a44a784710
--- /dev/null
+++ b/.github/workflows/external-pr-label.yml
@@ -0,0 +1,28 @@
+name: Mark External PRs
+
+on:
+  pull_request:
+    types: [opened]
+
+jobs:
+  on-pr-opened:
+    permissions:
+      pull-requests: write
+    runs-on: ubuntu-22.04
+    timeout-minutes: 1
+    if: ${{ !contains(github.event.pull_request.labels.*.name, 'External') }}
+    steps:
+      - uses: tspascoal/get-user-teams-membership@v3
+        id: checkUserMember
+        with:
+          username: ${{ github.actor }}
+          organization: 'metabase'
+          team: 'employees'
+          GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }} # Token with read:org scope
+
+      - name: add labels
+        uses: actions-ecosystem/action-add-labels@v1
+        if: ${{ steps.checkUserMember.outputs.isTeamMember == 'false' }}
+        with:
+          labels: |
+            External
-- 
GitLab