Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Autolabel pull requests by bots (#48579)

Lena37bd7b31f0f4
diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml
index 2e3dbb36383..cc9c4a9eefd 100644
--- a/.github/workflows/pr_labeler.yml
+++ b/.github/workflows/pr_labeler.yml
@@ -1,5 +1,5 @@
-# Labels pull requests by author: 'staff' for staff team members,
-# 'first contribution' for first-time external contributors.
+# Labels pull requests by author: 'bot' for bot accounts, 'staff' for
+# staff team members, 'first contribution' for first-time external contributors.
name: PR Labeler
on:
@@ -27,6 +27,7 @@ jobs:
with:
github-token: ${{ steps.get-app-token.outputs.token }}
script: |
+ const BOT_LABEL = 'bot';
const STAFF_LABEL = 'staff';
const FIRST_CONTRIBUTION_LABEL = 'first contribution';
const STAFF_TEAM_SLUG = 'staff';
@@ -34,9 +35,14 @@ jobs:
const pr = context.payload.pull_request;
const author = pr.user.login;
- // Skip bots (they shouldn't have FIRST_TIME* association anyway, but just in case)
- if (author.endsWith('[bot]')) {
- console.log(`Skipping bot author: ${author}`);
+ if (pr.user.type === 'Bot') {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr.number,
+ labels: [BOT_LABEL]
+ });
+ console.log(`PR #${pr.number} by ${author}: labeled '${BOT_LABEL}' (user type: '${pr.user.type}')`);
return;
}