You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/03/19 17:27:35 UTC

(superset) 01/01: feat(supersetbot): label PRs and issues with author's public org

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch orglabel
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a3d7b2ff5fffc84ddd394a08f1f44f8c05a7870e
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Tue Mar 19 10:16:54 2024 -0700

    feat(supersetbot): label PRs and issues with author's public org
    
    `supersetbot` has a CLI subcommand `orglabel` that looks at an
    issue or pr's author, their public association to organizations
    if one or many of these orgs are in a specific list, will add the
    org's name as a label on the PR.
    
    This PR hooks up this command to issue/pr creation as a github action.
    
    I also fix a bug where some line had been commented that shouldn't have
    been.
---
 .github/supersetbot/src/context.js   |  2 +-
 .github/workflows/issue_creation.yml | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/.github/supersetbot/src/context.js b/.github/supersetbot/src/context.js
index 8fe428ceed..9f6accb9fa 100644
--- a/.github/supersetbot/src/context.js
+++ b/.github/supersetbot/src/context.js
@@ -37,7 +37,7 @@ class Context {
     const optionValue = options[optionName];
     if (optionValue === undefined || optionValue === null) {
       this.logError(`option [${optionName}] is required`);
-      // this.exit(1);
+      this.exit(1);
     }
   }
 
diff --git a/.github/workflows/issue_creation.yml b/.github/workflows/issue_creation.yml
new file mode 100644
index 0000000000..b81cf2e18e
--- /dev/null
+++ b/.github/workflows/issue_creation.yml
@@ -0,0 +1,24 @@
+name: supersetbot org label based on author
+
+on:
+  # Note that this includes both issues and PRs
+  issues:
+    types: [created]
+
+jobs:
+  supersetbot:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Execute SupersetBot Command
+        uses: actions/setup-node@v4
+        with:
+          node-version: '20'
+      - run: npm install supersetbot
+      - name: Execute custom Node.js script
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          # First, label the issue with the appropriate org
+          # - this requires for the author to be publicly associated with their org
+          # - and for the org to be listed in `supersetbot/src/metadata.js`
+          superset orglabel --issue ${{ github.event.issue.number }} --repo ${{ github.repository }}