Skip to content

Commit 3c1358e

Browse files
committed
triger event handler
1 parent 55e65fa commit 3c1358e

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

.github/workflows/comment_bot.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ jobs:
3535
name: Debug
3636
runs-on: ubuntu-latest
3737
steps:
38-
- name: Checkout Arrow
39-
shell: bash
40-
run: echo "Triggered"
4138
- name: Event Name
4239
shell: bash
4340
run: echo "${{ github.event_name }} "
@@ -47,3 +44,23 @@ jobs:
4744
- name: Event Payload
4845
shell: bash
4946
run: cat ${{ github.event_path }}
47+
48+
- name: Checkout Arrow
49+
uses: actions/checkout@v2
50+
with:
51+
path: arrow
52+
- uses: s-weigand/setup-conda@v1
53+
with:
54+
update-conda: true
55+
python-version: 3.7
56+
conda-channels: conda-forge
57+
- run: conda --version
58+
- run: which python
59+
- run: |
60+
conda install -y --file arrow/ci/conda_env_crossbow.txt
61+
- run: |
62+
pip install -e arrow/dev/archery
63+
- run: |
64+
archery trigger-bot --evnt-name ${{ github.event_name }} --event-payload ${{ github.event_payload }}
65+
66+

dev/archery/archery/bot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ def handle_review_comment(self, payload):
147147

148148
@group(name='@ursabot')
149149
@click.pass_context
150-
def bot(ctx):
150+
def ursabot(ctx):
151151
"""Ursabot"""
152152
ctx.ensure_object(dict)
153153

154154

155-
@bot.group()
155+
@ursabot.group()
156156
@click.option('--arrow', '-a', default='apache/arrow',
157157
help='Arrow repository on github to use')
158158
@click.option('--crossbow', '-c', default='ursa-labs/crossbow',
159159
help='Crossbow repository on github to use')
160160
@click.pass_obj
161161
def crossbow(obj, arrow, crossbow):
162162
"""Trigger crossbow builds for this pull request"""
163-
obj['arrow_repo'] = 'https://github.com/{}'.format(arrow)
163+
# obj['arrow_repo'] = 'https://github.com/{}'.format(arrow)
164164
obj['crossbow_repo'] = 'https://github.com/{}'.format(crossbow)
165165

166166

@@ -185,6 +185,8 @@ def submit(obj, task, group, dry_run):
185185
git = Git()
186186
xbow = Crossbow('arrow/dev/tasks/crossbow.py')
187187

188+
# arrow is already cloned ideally but of course we should be able to choose
189+
# a different fork
188190
# git.clone(obj['arrow_repo'], 'arrow')
189-
# git.clone(obj['crossbow_repo'], 'crossbow')
191+
git.clone(obj['crossbow_repo'], 'crossbow')
190192
xbow.run('submit', *args)

dev/archery/archery/cli.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from .utils.logger import logger, ctx as log_ctx
3333
from .utils.source import ArrowSources
3434
from .utils.tmpdir import tmpdir
35+
from .bot import CommentBot, ursabot
3536

3637
# Set default logging to INFO in command line.
3738
logging.basicConfig(level=logging.INFO)
@@ -586,5 +587,18 @@ def integration(with_all=False, random_seed=12345, **args):
586587
run_all_tests(**args)
587588

588589

590+
@archery.command()
591+
@click.option('--event-name', '-n', required=True)
592+
@click.option('--event-payload', '-p', type=click.File('r', encoding='utf8'),
593+
default='-', required=True)
594+
@click.option('--github-token', '-t', envvar='CROSSBOW_GITHUB_TOKEN',
595+
help='OAuth token for GitHub authentication')
596+
def trigger_bot(event_name, event_payload, github_token):
597+
event_payload = json.loads(event_payload.read())
598+
599+
bot = CommentBot(name='ursabot', handler='ursabot', token=github_token)
600+
bot.handle(event_name, event_payload)
601+
602+
589603
if __name__ == "__main__":
590604
archery(obj={})

0 commit comments

Comments
 (0)