在GitHub pull request的操作中,我需要在“当前主分支”的上下文中运行一些代码,并稍后在PR分支的上下文中重新运行同样的代码。
我可以检查与被PR的基本分支进行比较的pull request。如何找到基本分支的SHA值(例如,如果PR是针对master,则为当前的master)?
我可以检查与被PR的基本分支进行比较的pull request。如何找到基本分支的SHA值(例如,如果PR是针对master,则为当前的master)?
jobs:
job_on_base:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: "${{ github.base_ref }}"
- run: |
# Seems like I can get it here with $(git log -1 --format="%H")
echo "My current SHA is ... ?"
job_on_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: "${{ github.ref }}"
- run: |
echo "My current SHA is $GITHUB_SHA"
echo "The BASE SHA is ?"
${{github.event.pull_request.head.sha}}
。https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit - Danny Varod