97 lines
3.5 KiB
YAML
97 lines
3.5 KiB
YAML
name: Slash Command Dispatch
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
jobs:
|
|
slashCommandDispatch:
|
|
name: Dispatch
|
|
if: startsWith(github.event.comment.body, '/')
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Authenticate as GitHub App
|
|
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
|
|
id: get-app-token
|
|
with:
|
|
owner: "airbytehq"
|
|
repositories: "airbyte"
|
|
app-id: ${{ secrets.OCTAVIA_BOT_APP_ID }}
|
|
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
|
|
|
|
- name: Get PR repo and ref
|
|
if: ${{ github.event.issue.pull_request }}
|
|
id: getref
|
|
env:
|
|
GH_TOKEN: ${{ steps.get-app-token.outputs.token }}
|
|
PR_URL: ${{ github.event.issue.pull_request.url }}
|
|
run: |
|
|
set -euo pipefail
|
|
# Fetch PR info with authentication to avoid rate limiting
|
|
HTTP_CODE=$(curl -sS -w "%{http_code}" -o /tmp/pr_info.json \
|
|
-H "Authorization: Bearer $GH_TOKEN" \
|
|
-H "Accept: application/vnd.github+json" \
|
|
"$PR_URL")
|
|
|
|
if [[ "$HTTP_CODE" != "200" ]]; then
|
|
echo "::error::Failed to fetch PR info: HTTP $HTTP_CODE"
|
|
cat /tmp/pr_info.json
|
|
exit 1
|
|
fi
|
|
|
|
# Extract fields with validation (jq -e fails if field is null)
|
|
REF=$(jq -er '.head.ref' /tmp/pr_info.json)
|
|
REPO=$(jq -er '.head.repo.full_name' /tmp/pr_info.json)
|
|
|
|
# Log parsed values for debugging
|
|
echo "::notice::Parsed PR metadata - repo: '$REPO', ref: '$REF'"
|
|
|
|
echo "ref=$REF" >> $GITHUB_OUTPUT
|
|
echo "repo=$REPO" >> $GITHUB_OUTPUT
|
|
|
|
- name: Slash Command Dispatch (Workflow)
|
|
id: scd
|
|
uses: peter-evans/slash-command-dispatch@f996d7b7aae9059759ac55e978cff76d91853301 # v3.0.2
|
|
with:
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
permission: write
|
|
dispatch-type: workflow
|
|
issue-type: both
|
|
|
|
commands: |
|
|
ai-canary-prerelease
|
|
ai-prove-fix
|
|
ai-release-watch
|
|
approve-regression-tests
|
|
bump-bulk-cdk-version
|
|
bump-progressive-rollout-version
|
|
bump-version
|
|
build-connector-images
|
|
connector-performance
|
|
format-fix
|
|
poe
|
|
publish-connectors-prerelease
|
|
publish-java-cdk
|
|
run-cat-tests
|
|
run-connector-tests
|
|
run-live-tests
|
|
run-regression-tests
|
|
test-performance
|
|
update-connector-cdk-version
|
|
|
|
# Notes regarding static-args:
|
|
# - Slash commands can be invoked from both issues and comments.
|
|
# - If the slash command is invoked from an issue, we intentionally pass 'null' as the PR number.
|
|
# - Comment ID will always be sent, and this is sufficient to post back status updates to the originating comment.
|
|
static-args: |
|
|
repo=${{ steps.getref.outputs.repo }}
|
|
gitref=${{ steps.getref.outputs.ref }}
|
|
comment-id=${{ github.event.comment.id }}
|
|
pr=${{ github.event.issue.pull_request != null && github.event.issue.number || '' }}
|
|
|
|
- name: Edit comment with error message
|
|
if: steps.scd.outputs.error-message
|
|
uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae # v1.4.5
|
|
with:
|
|
comment-id: ${{ github.event.comment.id }}
|
|
body: |
|
|
> Error: ${{ steps.scd.outputs.error-message }}
|