mirror of
https://github.com/shenxn/protonmail-bridge-docker.git
synced 2026-03-26 21:35:58 +00:00
Fix invalid Docker tag for PRs with slashes in ref name
github.ref_name returns '4/merge' for PR events, which is invalid in a Docker tag. Sanitize using the head ref (branch name) with slashes replaced by dashes.
This commit is contained in:
parent
82bd9081c8
commit
8cec76db7f
7
.github/workflows/build.yaml
vendored
7
.github/workflows/build.yaml
vendored
@ -31,6 +31,9 @@ jobs:
|
|||||||
- name: Set version
|
- name: Set version
|
||||||
run: echo "version=$(cat VERSION)" >> $GITHUB_ENV
|
run: echo "version=$(cat VERSION)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Sanitize ref for Docker tag
|
||||||
|
run: echo "SAFE_TAG=$(echo "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" | tr '/' '-')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@ -55,7 +58,7 @@ jobs:
|
|||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
context: ./build
|
context: ./build
|
||||||
file: ./build/Dockerfile
|
file: ./build/Dockerfile
|
||||||
tags: "${{ env.DOCKER_REPO_DEV }}:dev-${{ github.ref_name }}"
|
tags: "${{ env.DOCKER_REPO_DEV }}:dev-${{ env.SAFE_TAG }}"
|
||||||
push: true
|
push: true
|
||||||
build-args: |
|
build-args: |
|
||||||
version=${{ env.version }}
|
version=${{ env.version }}
|
||||||
@ -63,7 +66,7 @@ jobs:
|
|||||||
- name: Run Trivy vulnerability scan
|
- name: Run Trivy vulnerability scan
|
||||||
uses: aquasecurity/trivy-action@0.30.0
|
uses: aquasecurity/trivy-action@0.30.0
|
||||||
with:
|
with:
|
||||||
image-ref: "${{ env.DOCKER_REPO_DEV }}:dev-${{ github.ref_name }}"
|
image-ref: "${{ env.DOCKER_REPO_DEV }}:dev-${{ env.SAFE_TAG }}"
|
||||||
format: 'sarif'
|
format: 'sarif'
|
||||||
exit-code: 0
|
exit-code: 0
|
||||||
severity: 'CRITICAL,HIGH'
|
severity: 'CRITICAL,HIGH'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user