mirror of
https://github.com/apache/superset.git
synced 2026-04-14 13:44:46 +00:00
feat(supersetbot): introduce supersetbot as its own npm package, CLI and comment-operated bot (#27046)
This commit is contained in:
committed by
GitHub
parent
26d8077e97
commit
24cb06285c
26
.github/workflows/docker-release.yml
vendored
26
.github/workflows/docker-release.yml
vendored
@@ -45,21 +45,18 @@ jobs:
|
||||
build_preset: ["dev", "lean", "py310", "websocket", "dockerize"]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
submodules: recursive
|
||||
ref: ${{ github.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker Image
|
||||
- name: Setup Node Env
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
- run: npm install -g supersetbot
|
||||
- name: Execute custom Node.js script
|
||||
env:
|
||||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
@@ -79,11 +76,10 @@ jobs:
|
||||
cp /tmp/build_docker.py scripts/
|
||||
EVENT="release"
|
||||
fi
|
||||
pip install click
|
||||
# Make a multi-platform image
|
||||
./scripts/build_docker.py \
|
||||
${{ matrix.build_preset }} \
|
||||
"$EVENT" \
|
||||
--build_context_ref "$RELEASE" $FORCE_LATEST \
|
||||
|
||||
supersetbot docker \
|
||||
--preset ${{ matrix.build_preset }} \
|
||||
--context "$EVENT" \
|
||||
--context-ref "$RELEASE" $FORCE_LATEST \
|
||||
--platform "linux/arm64" \
|
||||
--platform "linux/amd64"
|
||||
|
||||
40
.github/workflows/docker.yml
vendored
40
.github/workflows/docker.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Docker
|
||||
name: Build & publish docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -34,10 +34,6 @@ jobs:
|
||||
build_preset: ${{fromJson(needs.setup_matrix.outputs.matrix_config)}}
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
@@ -45,24 +41,34 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Setup Node Env
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
- name: install supersetbot
|
||||
run: |
|
||||
npm install -g supersetbot
|
||||
|
||||
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Build Docker Image
|
||||
shell: bash
|
||||
env:
|
||||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: |
|
||||
pip install click
|
||||
# Single platform builds in pull_request context to speed things up
|
||||
if [ "${{ github.event_name }}" = "push" ]; then
|
||||
./scripts/build_docker.py \
|
||||
${{ matrix.build_preset }} \
|
||||
${{ github.event_name }} \
|
||||
--build_context_ref "$RELEASE" $FORCE_LATEST \
|
||||
--platform "linux/arm64" \
|
||||
--platform "linux/amd64"
|
||||
PLATFORM_ARG="--platform linux/arm64 --platform linux/amd64"
|
||||
elif [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
./scripts/build_docker.py \
|
||||
${{ matrix.build_preset }} \
|
||||
${{ github.event_name }} \
|
||||
--build_context_ref "$RELEASE" $FORCE_LATEST \
|
||||
--platform "linux/amd64"
|
||||
PLATFORM_ARG="--platform linux/amd64"
|
||||
fi
|
||||
|
||||
supersetbot docker \
|
||||
--preset ${{ matrix.build_preset }} \
|
||||
--context "$EVENT" \
|
||||
--context-ref "$RELEASE" $FORCE_LATEST \
|
||||
$PLATFORM_ARG
|
||||
|
||||
57
.github/workflows/supersetbot.yml
vendored
Normal file
57
.github/workflows/supersetbot.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: SupersetBot Workflow
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
|
||||
# Making the workflow testable since `issue_comment` only triggers on
|
||||
# the default branch
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
comment_body:
|
||||
description: 'Comment Body'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
supersetbot:
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@supersetbot'))
|
||||
steps:
|
||||
- name: Quickly add thumbs up!
|
||||
uses: actions/github-script@v5
|
||||
with:
|
||||
script: |
|
||||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: ${{ github.event.comment.id }},
|
||||
content: '+1'
|
||||
});
|
||||
- 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 }}
|
||||
GITHUB_ACTOR: ${{ github.actor }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
COMMENT_BODY: ${{ github.event.comment.body }}
|
||||
INPUT_COMMENT_BODY: ${{ github.event.inputs.comment_body }}
|
||||
run: |
|
||||
cat <<EOF > script.js
|
||||
const run = async () => {
|
||||
const { runCommandFromGithubAction } = await import('supersetbot');
|
||||
const cmd = process.env.COMMENT_BODY || process.env.INPUT_COMMENT_BODY;
|
||||
console.log("Executing: ", cmd);
|
||||
await runCommandFromGithubAction(cmd);
|
||||
};
|
||||
run().catch(console.error);
|
||||
EOF
|
||||
node script.js
|
||||
Reference in New Issue
Block a user