Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmarks.yml: Fix PR branch checkout when triggered by comment #1998

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,36 @@ jobs:
path: benchmarks/timings_1.pickle
- name: Checkout PR branch
uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
persist-credentials: false
clean: false
- name: Checkout PR branch from issue comment
EwoutH marked this conversation as resolved.
Show resolved Hide resolved
if: github.event_name == 'issue_comment'
uses: actions/github-script@v5
with:
script: |
const issue_number = context.issue.number;
const repository = context.repo.repo;
const owner = context.repo.owner;
const pr = await github.rest.pulls.get({ owner, repo: repository, pull_number: issue_number });
const ref = pr.data.head.ref;
const repoFullName = pr.data.head.repo.full_name;
console.log(`::set-output name=ref::${ref}`);
console.log(`::set-output name=repo::${repoFullName}`);
result-encoding: string
- name: Actual Checkout for Issue Comment
if: github.event_name == 'issue_comment'
uses: actions/checkout@v4
with:
repository: ${{ steps.checkout-pr-branch-from-issue-comment.outputs.repo }}
ref: ${{ steps.checkout-pr-branch-from-issue-comment.outputs.ref }}
fetch-depth: 0
persist-credentials: false
clean: false
- name: Download benchmark results
uses: actions/download-artifact@v4
with:
Expand Down