我正在GitHub中创建一个工作流程,其中创建并使用一个docker镜像。因此,我在我的工作流文件中使用了一个全局环境变量来存储该docker镜像,该变量对于工作流程中的所有作业都可见:
name: continuous integration
on:
push:
branches:
- '**'
env:
IMAGE: docker.pkg.github.com/${{ github.repository }}/jactor-persistence:${{ github.sha }}
我想用头提交的短SHA替换${{ github.sha }}
,就像以下命令的结果一样:git rev-parse --short HEAD
这个可行吗?
echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.event.pull_request.head.sha }})"
- Yoon-Jae Jeongecho "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- Coder1