【发布时间】:2021-07-16 20:05:47
【问题描述】:
我想验证来自输入 (workflow_dispatch) 的提交哈希:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Run only if input exist (Validate input hash)
if: ${{ github.event.inputs.sha != '' }}
run: git cat-file -e ${{ github.event.inputs.sha }}^{commit}
问题是它只适用于最新的提交。
如果我使用任何其他提交,它会说:
fatal: Not a valid object name COMMIT_HASH^{commit}
Error: Process completed with exit code 128.
但它在本地工作。我也试过这种方式:
git cat-file -e ${{ github.event.inputs.sha }}
git cat-file commit ${{ github.event.inputs.sha }}
【问题讨论】:
标签: git github-actions git-commit