Skip to content

Commit

Permalink
Backport PR #52693 on branch 2.0.x (CI: Consolidate more comment comm…
Browse files Browse the repository at this point in the history
…and workflows) (#52805)

Backport PR #52693: CI: Consolidate more comment command workflows
  • Loading branch information
mroeschke committed Apr 20, 2023
1 parent 115e8a8 commit 6812451
Showing 1 changed file with 33 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
name: "ASV Bot"

name: Comment Commands
on:
issue_comment: # Pull requests are issues
types:
- created

env:
ENV_FILE: environment.yml
COMMENT: ${{github.event.comment.body}}
issue_comment:
types: created

permissions:
contents: read
issues: write
pull-requests: write

jobs:
autotune:
permissions:
contents: read
issues: write
pull-requests: write
name: "Run benchmarks"
# TODO: Support more benchmarking options later, against different branches, against self, etc
if: startsWith(github.event.comment.body, '@github-actions benchmark')
issue_assign:
runs-on: ubuntu-22.04
if: (!github.event.issue.pull_request) && github.event.comment.body == 'take'
concurrency:
group: ${{ github.actor }}-issue-assign
steps:
run: |
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}"
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
preview_docs:
runs-on: ubuntu-22.04
if: github.event.issue.pull_request && github.event.comment.body == '/preview'
concurrency:
group: ${{ github.actor }}-preview-docs
steps:
run: |
if curl --output /dev/null --silent --head --fail "https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"; then
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
else
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
fi
asv_run:
runs-on: ubuntu-22.04
# TODO: Support more benchmarking options later, against different branches, against self, etc
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '@github-actions benchmark')
defaults:
run:
shell: bash -el {0}
env:
ENV_FILE: environment.yml
COMMENT: ${{github.event.comment.body}}

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

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

0 comments on commit 6812451

Please sign in to comment.