Skip to content

Commit 6359e22

Browse files
Adding new optional workflow
1 parent d2798db commit 6359e22

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/comment_action.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Comment Commands to Trigger CI
2+
on:
3+
issue_comment:
4+
types: created
5+
6+
permissions:
7+
checks: write
8+
9+
env:
10+
RUN_COMMAND: '{"/pandas_nightly": "pytest --nightly", "/pyright_strict": "pyright_strict", "/mypy_nightly": "mypy --mypy_nightly"}'
11+
DISPLAY_COMMAND: '{"/pandas_nightly": "Run pandas nightly tests", "/pyright_strict": "Pyright strict tests", "/mypy_nightly": "Mypy nightly tests"}'
12+
13+
jobs:
14+
pandas_nightly:
15+
runs-on: ubuntu-latest
16+
env:
17+
COMMENT: "/pandas_nightly"
18+
timeout-minutes: 10
19+
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/pyright_strict"]'), github.event.comment.body)
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install project dependencies
25+
uses: ./.github/setup
26+
with:
27+
os: ubuntu-latest
28+
python-version: "3.11"
29+
30+
- name: Run ${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}
31+
id: tests-step
32+
run: poetry run poe ${{ fromJSON(env.RUN_COMMAND)[github.event.comment.body] }}
33+
34+
- name: Get head sha and store value
35+
if: always()
36+
id: get-sha
37+
uses: actions/github-script@v7
38+
with:
39+
github-token: ${{ secrets.GITHUB_TOKEN }}
40+
script: |
41+
const pr = await github.rest.pulls.get({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
pull_number: ${{ github.event.issue.number }}
45+
})
46+
core.setOutput('sha', pr.data.head.sha)
47+
48+
- name: Report results of the tests and publish
49+
if: always()
50+
uses: actions/github-script@v7
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
script: |
54+
github.rest.checks.create({
55+
name: '${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}',
56+
head_sha: '${{ steps.get-sha.outputs.sha }}',
57+
status: 'completed',
58+
conclusion: '${{ steps.tests-step.outcome }}',
59+
output: {
60+
title: 'Run pandas nightly tests',
61+
summary: 'Results: ${{ steps.tests-step.outcome }}',
62+
text: 'See the actions run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
63+
},
64+
owner: context.repo.owner,
65+
repo: context.repo.repo
66+
})

0 commit comments

Comments
 (0)