diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml index 85157760d66..4fe5527f152 100644 --- a/.github/workflows/comment_bot.yml +++ b/.github/workflows/comment_bot.yml @@ -56,6 +56,58 @@ jobs: --event-name ${{ github.event_name }} \ --event-payload ${{ github.event_path }} + ci: + name: Listen CI! + if: startsWith(github.event.comment.body, '@github-actions ci') && ${{ github.event.issue.pull_request }} + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Checkout Arrow + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + path: arrow + # fetch the tags for version number generation + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: 3.12 + - name: Parse comment + id: parse_comment + uses: actions/github-script@v7 + with: + script: | + let body = context.payload.comment.body.trim(); + // Match format: @github-actions ci -w workflow_name regex + const match = body.match(/^@github-actions ci\s+-w\s+(\S+)\s+(.+)$/); + if (!match) { + core.setFailed('Comment format invalid. Expected: @github-actions ci -w workflow_name regex'); + } else { + const workflow = match[1]; + const regex = match[2]; + core.setOutput('workflow', workflow); + core.setOutput('regex', regex); + } + - name: Handle GitHub comment event + run: | + echo ${{ steps.parse_comment.outputs.workflow }} + echo ${{ steps.parse_comment.outputs.regex }} + - name: Run workflow + id: run_workflow + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pr_branch=$(gh pr view ${{ github.event.issue.number }} \ + --jq '.headRefName' \ + --json headRefName \ + --repo ${GITHUB_REPOSITORY}) + echo "pr_branch=${pr_branch}" + cd arrow + gh workflow run ${{ steps.parse_comment.outputs.workflow }}.yml \ + --ref ${pr_branch} \ + -f regex=${{ steps.parse_comment.outputs.regex }} + issue_assign: name: "Assign issue" permissions: diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 2907ae3bcd1..1ba6fdb8d41 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -62,6 +62,12 @@ on: - opened - reopened - synchronize + workflow_dispatch: + inputs: + regex: + description: "Regex pattern to run specific jobs" + type: string + required: true schedule: - cron: | 0 0 * * * @@ -113,6 +119,9 @@ jobs: fi fi ;; + workflow_dispatch) + ci_extra=true + ;; esac echo "ci-extra=${ci_extra}" >> "${GITHUB_OUTPUT}" diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py index 48ad466977c..a8735916fd2 100644 --- a/dev/archery/archery/cli.py +++ b/dev/archery/archery/cli.py @@ -823,6 +823,7 @@ def integration(with_all=False, random_seed=12345, **args): @click.option('--event-payload', '-p', type=click.File('r', encoding='utf8'), default='-', required=True) def trigger_bot(arrow_token, committers_file, event_name, event_payload): + print("Test") from .bot import CommentBot, PullRequestWorkflowBot, actions from ruamel.yaml import YAML