From d18c621e7d484fd7a3176e16fbf21a1b1e82d1e0 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 2 Apr 2024 20:28:00 -0700 Subject: [PATCH] feat: move supersetbot out of repo (#27647) --- .github/actions/setup-supersetbot/action.yml | 35 +- .github/supersetbot/.eslintrc.json | 22 - .github/supersetbot/README.md | 37 - .github/supersetbot/jest.config.js | 8 - .github/supersetbot/package-lock.json | 11020 ----------------- .github/supersetbot/package.json | 36 - .github/supersetbot/src/cli.js | 175 - .github/supersetbot/src/cli.test.js | 12 - .github/supersetbot/src/context.js | 152 - .github/supersetbot/src/docker.js | 142 - .github/supersetbot/src/docker.test.js | 244 - .github/supersetbot/src/git.js | 120 - .github/supersetbot/src/git_release.js | 50 - .github/supersetbot/src/github.js | 252 - .github/supersetbot/src/index.js | 39 - .github/supersetbot/src/index.test.js | 51 - .github/supersetbot/src/metadata.js | 36 - .github/supersetbot/src/supersetbot | 27 - .github/supersetbot/src/utils.js | 78 - .github/workflows/docker-release.yml | 7 +- .github/workflows/docker.yml | 5 - .github/workflows/issue_creation.yml | 12 +- .github/workflows/supersetbot.yml | 29 +- 23 files changed, 50 insertions(+), 12539 deletions(-) delete mode 100644 .github/supersetbot/.eslintrc.json delete mode 100644 .github/supersetbot/README.md delete mode 100644 .github/supersetbot/jest.config.js delete mode 100644 .github/supersetbot/package-lock.json delete mode 100644 .github/supersetbot/package.json delete mode 100755 .github/supersetbot/src/cli.js delete mode 100644 .github/supersetbot/src/cli.test.js delete mode 100644 .github/supersetbot/src/context.js delete mode 100644 .github/supersetbot/src/docker.js delete mode 100644 .github/supersetbot/src/docker.test.js delete mode 100644 .github/supersetbot/src/git.js delete mode 100644 .github/supersetbot/src/git_release.js delete mode 100644 .github/supersetbot/src/github.js delete mode 100644 .github/supersetbot/src/index.js delete mode 100644 .github/supersetbot/src/index.test.js delete mode 100644 .github/supersetbot/src/metadata.js delete mode 100755 .github/supersetbot/src/supersetbot delete mode 100644 .github/supersetbot/src/utils.js diff --git a/.github/actions/setup-supersetbot/action.yml b/.github/actions/setup-supersetbot/action.yml index 155af26c08e45..e2a7034b8599f 100644 --- a/.github/actions/setup-supersetbot/action.yml +++ b/.github/actions/setup-supersetbot/action.yml @@ -1,11 +1,36 @@ name: 'Setup supersetbot' -description: 'Sets up supersetbot npm lib from the repo' +description: 'Sets up supersetbot npm lib from the repo or npm' +inputs: + from-npm: + description: 'Install from npm instead of local setup' + required: false + default: 'true' # Defaults to using the local setup runs: using: 'composite' steps: - - name: Install dependencies + + - name: Setup Node Env + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install supersetbot from npm + if: ${{ inputs.from-npm == 'true' }} shell: bash + run: npm install -g supersetbot + + - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" + if: ${{ inputs.from-npm == 'false' }} + uses: actions/checkout@v4 + with: + repository: apache-superset/supersetbot + path: supersetbot + + - name: Setup supersetbot from repo + if: ${{ inputs.from-npm == 'false' }} + shell: bash + working-directory: supersetbot run: | - cd .github/supersetbot - npm install - npm link + # simple trick to install globally with dependencies + npm pack + npm install -g ./supersetbot*.tgz diff --git a/.github/supersetbot/.eslintrc.json b/.github/supersetbot/.eslintrc.json deleted file mode 100644 index 22f0d26d28384..0000000000000 --- a/.github/supersetbot/.eslintrc.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "airbnb-base", - "rules": { - "import/extensions": 0, - "import/prefer-default-export": 0, - "func-names": 0, - "no-console": 0, - "class-methods-use-this": 0 - }, - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module" - }, - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "requireConfigFile": false - }, - "env": { - "jest": true - } -} diff --git a/.github/supersetbot/README.md b/.github/supersetbot/README.md deleted file mode 100644 index 4042e985ce3fc..0000000000000 --- a/.github/supersetbot/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# supersetbot - -supersetbot is a utility bot that can be used to help around GitHub, CI and beyond. - -The bot can be used as a local CLI OR, for a subset of fitted use cases, can be invoked directly -from GitHub comments. - -Because it's its own npm app, it can be tested/deployed/used in isolation from the rest of -Superset, and take on some of the complexity from GitHub actions and onto a nifty -utility that can be used in different contexts. - -## Features - -```bash -$ use nvm 20 -$ npm i -g supersetbot -$ supersetbot -Usage: supersetbot [options] [command] - -Options: - -v, --verbose Output extra debugging information - -r, --repo The GitHub repo to use (ie: "apache/superset") - -d, --dry-run Run the command in dry-run mode - -a, --actor The actor - -h, --help display help for command - -Commands: - label [options]