Skip to content

Commit 6812451

Browse files
authored
Backport PR #52693 on branch 2.0.x (CI: Consolidate more comment command workflows) (#52805)
Backport PR #52693: CI: Consolidate more comment command workflows
1 parent 115e8a8 commit 6812451

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

.github/workflows/asv-bot.yml renamed to .github/workflows/comment-commands.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
1-
name: "ASV Bot"
2-
1+
name: Comment Commands
32
on:
4-
issue_comment: # Pull requests are issues
5-
types:
6-
- created
7-
8-
env:
9-
ENV_FILE: environment.yml
10-
COMMENT: ${{github.event.comment.body}}
3+
issue_comment:
4+
types: created
115

126
permissions:
137
contents: read
8+
issues: write
9+
pull-requests: write
1410

1511
jobs:
16-
autotune:
17-
permissions:
18-
contents: read
19-
issues: write
20-
pull-requests: write
21-
name: "Run benchmarks"
22-
# TODO: Support more benchmarking options later, against different branches, against self, etc
23-
if: startsWith(github.event.comment.body, '@github-actions benchmark')
12+
issue_assign:
13+
runs-on: ubuntu-22.04
14+
if: (!github.event.issue.pull_request) && github.event.comment.body == 'take'
15+
concurrency:
16+
group: ${{ github.actor }}-issue-assign
17+
steps:
18+
run: |
19+
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
20+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
21+
preview_docs:
2422
runs-on: ubuntu-22.04
23+
if: github.event.issue.pull_request && github.event.comment.body == '/preview'
24+
concurrency:
25+
group: ${{ github.actor }}-preview-docs
26+
steps:
27+
run: |
28+
if curl --output /dev/null --silent --head --fail "https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"; then
29+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "Website preview of this PR available at: https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments
30+
else
31+
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "No preview found for PR #${{ github.event.issue.number }}. Did the docs build complete?"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments
32+
fi
33+
asv_run:
34+
runs-on: ubuntu-22.04
35+
# TODO: Support more benchmarking options later, against different branches, against self, etc
36+
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '@github-actions benchmark')
2537
defaults:
2638
run:
2739
shell: bash -el {0}
40+
env:
41+
ENV_FILE: environment.yml
42+
COMMENT: ${{github.event.comment.body}}
2843

2944
concurrency:
3045
# Set concurrency to prevent abuse(full runs are ~5.5 hours !!!)
@@ -47,7 +62,7 @@ jobs:
4762

4863
- name: Run benchmarks
4964
id: bench
50-
continue-on-error: true # This is a fake failure, asv will exit code 1 for regressions
65+
continue-on-error: true # asv will exit code 1 for regressions
5166
run: |
5267
# extracting the regex, see https://stackoverflow.com/a/36798723
5368
REGEX=$(echo "$COMMENT" | sed -n "s/^.*-b\s*\(\S*\).*$/\1/p")

0 commit comments

Comments
 (0)