Browse Source

ref(ci): Use github-label-sync from npm over the micnncim/action-label-syncer (#36898)

Evan Purkhiser 2 years ago
parent
commit
88892a6c8a
2 changed files with 131 additions and 84 deletions
  1. 75 75
      .github/labels.yml
  2. 56 9
      .github/workflows/sync-labels.yml

+ 75 - 75
.github/labels.yml

@@ -41,10 +41,10 @@
   description: stalebot will ignore
 - name: 'Status: Invalid'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Status: Investigating'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Status: Needs More Information'
   color: '8D5494'
   description: stalebot will close after four weeks of inactivity
@@ -61,99 +61,99 @@
 # Issue type
 - name: 'Type: Bug'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: CI Flakiness'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: Design'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: Feature Request'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: Improvement'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: Support'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: Support Request'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Type: User Feedback'
   color: '584774'
-  description: null
+  description: ''
 
 # Components
 - name: 'Component: Analytics'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: API'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Auth'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Beacon'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: CI'
   color: '584774'
   description: Continuous Integration pipeline (GitHub Actions)
 - name: 'Component: Core Frontend (React)'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Debugger'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Developer Environment'
   color: '584774'
   description: This covers issues related to setting up a developer's environment to be able to contribute to Sentr
 - name: 'Component: Documentation'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Event Pipeline'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Feedback'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Grouping'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: i18n'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Inbound Filters'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Integrations'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Issues'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Logging'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Monitoring'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Notifications'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Onboarding'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Package'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Relay'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Releases'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Replay Details'
   color: '584774'
   description: Session Replays → Details
@@ -162,25 +162,25 @@
   description: Session Replays → Index page
 - name: 'Component: Rules'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: SDK'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Search'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Source Maps'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: UI'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: User Crash Report'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Component: Workflow'
   color: '584774'
-  description: null
+  description: ''
 
 # Teams
 - name: 'Team: Backend'
@@ -188,25 +188,25 @@
   description: app-backend
 - name: 'Team: Design'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Ecosystem'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Emerging Technology'
   color: '8D5494'
   description: team-emerging-technology
 - name: 'Team: Enterprise'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Front End'
   color: '8D5494'
   description: app-frontend
 - name: 'Team: Growth'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Infrastructure'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Ingest'
   color: '8D5494'
   description: owners-ingest
@@ -218,22 +218,22 @@
   description: owners-native
 - name: 'Team: Open Source'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Ops'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Revenue'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Search & Storage'
   color: '8D5494'
   description: sns
 - name: 'Team: Support'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Visibility'
   color: '8D5494'
-  description: null
+  description: ''
 - name: 'Team: Web SDKs - Backend'
   color: '8D5494'
   description: team-web-sdk-backend
@@ -242,7 +242,7 @@
   description: team-web-sdk-frontend
 - name: 'Team: Workflow'
   color: '8D5494'
-  description: null
+  description: ''
 
 # Deploy types
 - name: 'Deploy: Monitored'
@@ -255,15 +255,15 @@
 # Feature types
 - name: 'Feature: Alert Rule'
   color: '8A7259'
-  description: null
+  description: ''
 - name: 'Feature: Errors'
   color: 'ffa0df'
-  description: null
+  description: ''
 
 # Hacktoberfest
 - name: 'Hacktoberfest :jack_o_lantern:'
   color: 'ffa500'
-  description: null
+  description: ''
 - name: Hacktoberfest-accepted
   color: 'e99695'
   description: Accept for Hacktoberfest - will merge later
@@ -271,76 +271,76 @@
 # Impacts
 - name: 'Impact: Large'
   color: 'C83852'
-  description: null
+  description: ''
 - name: 'Impact: Medium'
   color: 'FFB287'
-  description: null
+  description: ''
 - name: 'Impact: Migration'
   color: 'C83852'
-  description: null
+  description: ''
 - name: 'Impact: Small'
   color: '452650'
-  description: null
+  description: ''
 
 # Platforms
 - name: 'Platform: Cocoa'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: Dart'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: Java'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: JavaScript'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: PHP'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: Python'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: Ruby'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Platform: Unity'
   color: '584774'
-  description: null
+  description: ''
 
 # Hosting type
 - name: 'Hosting: Self-hosted'
   color: '584774'
-  description: null
+  description: ''
 - name: 'Hosting: sentry.io'
   color: '584774'
-  description: null
+  description: ''
 
 # Legacy tags
 - name: WIP
   color: 'F6F6F8'
-  description: null
+  description: ''
 - name: 'Package: browser'
   color: '6780AD'
-  description: null
+  description: ''
 - name: Design Review
   color: 'F6F6F8'
-  description: null
+  description: ''
 - name: Do Not Merge
   color: 'C83852'
   description: Don't merge
 - name: Easy Task
   color: 'F6F6F8'
-  description: null
+  description: ''
 - name: enhancement
   color: 'a2eeef'
-  description: null
+  description: ''
 - name: help wanted
   color: '159818'
-  description: null
+  description: ''
 - name: invalid
   color: 'F6F6F8'
-  description: null
+  description: ''
 - name: javascript
   color: 'F6F6F8'
   description: Pull requests that update Javascript code
@@ -349,7 +349,7 @@
   description: Pull requests that update Python code
 - name: Security
   color: 'C83852'
-  description: null
+  description: ''
 - name: wcgw
   color: 'F6F6F8'
-  description: null
+  description: ''

+ 56 - 9
.github/workflows/sync-labels.yml

@@ -1,20 +1,67 @@
-name: Sync labels
+name: meta(labels)
 on:
+  pull_request:
+    paths:
+      - .github/labels.yml
   push:
     branches:
       - master
     paths:
       - .github/labels.yml
 jobs:
-  build:
+  sync:
+    name: syncs reposiory labels
     runs-on: ubuntu-latest
-    # Labels can be manipulated with no permissions
-    permissions: {}
+    permissions:
+      issues: write
+      pull-requests: write
     steps:
       - uses: actions/checkout@v3
-      - uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - uses: ./.github/actions/setup-volta
+
+      - name: Install github-label-sync
+        run: yarn global add github-label-sync@2.2.0
+
+      - name: Run github-label-sync
+        run: |
+          github-label-sync \
+            --access-token ${{ secrets.GITHUB_TOKEN }} \
+            --labels .github/labels.yml \
+            ${{ github.event_name == 'pull_request' && '--dry-run' || '' }} \
+            ${{ github.repository }} \
+            2>&1 | tee sync-report.txt
+
+      - name: Read sync output into variable
+        uses: actions/github-script@v4
+        if: github.event_name == 'pull_request'
+        id: github-label-sync
+        with:
+          script: |
+            const fs = require('fs');
+            return fs.readFileSync('sync-report.txt','utf8').toString();
+          result-encoding: string
+
+      - name: Find previous dry-run comment
+        uses: peter-evans/find-comment@1769778a0c5bd330272d749d12c036d65e70d39d
+        if: github.event_name == 'pull_request'
+        id: fc
+        with:
+          issue-number: ${{ github.event.pull_request.number }}
+          comment-author: 'github-actions[bot]'
+          body-includes: '<!-- LABELS_UPDATE -->'
+
+      - name: Add or update dry-run comment
+        uses: peter-evans/create-or-update-comment@b95e16d2859ad843a14218d1028da5b2c4cbc4b4
+        if: github.event_name == 'pull_request'
         with:
-          manifest: .github/labels.yml
-          prune: false
+          issue-number: ${{ github.event.pull_request.number }}
+          comment-id: ${{ steps.fc.outputs.comment-id }}
+          edit-mode: replace
+          body: >
+            <!-- LABELS_UPDATE -->
+
+            🏷  The following changes will be made to the repository labels
+
+            ```
+            ${{ steps.github-label-sync.outputs.result }}
+            ```