Skip to content

Commit

Permalink
set pr sh from context
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Dec 18, 2024
1 parent 4ad0ca4 commit cecd991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
test-and-push:
runs-on: ubuntu-latest
steps:
- name: Set Pull Request Head SHA
if: ${{ github.event_name == 'pull_request' }}
run: |
long_sha=${{ github.event.pull_request.head.sha }}
echo "PR_HEAD_SHA=${long_sha:0:7}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand Down
7 changes: 3 additions & 4 deletions docker/common
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
REGISTRY=ghcr.io
PACKAGE_ORG=mrc-ide
PACKAGE_NAME=grout
if [[ "${GITHUB_EVENT_NAME}" = pull_request ]]; then
LONG_SHA=${GITHUB_SHA}
GIT_SHA=${LONG_SHA:0:7}
else
if [[ -z "${PR_HEAD_SHA}" ]]; then
GIT_SHA=$(git -C "$PACKAGE_ROOT" rev-parse --short=7 HEAD)
else
GIT_SHA=${PR_HEAD_SHA}
fi
if [[ -v "BRANCH_NAME" ]]; then
GIT_BRANCH=${BRANCH_NAME}
Expand Down

0 comments on commit cecd991

Please sign in to comment.