Skip to content

Commit f83ccd4

Browse files
authored
MRG: Merge pull request #13 from octue/fix-shorten-revision-tag-for-pull-requests
Shorten revision tag for pull requests
2 parents d9b573d + 4f872c5 commit f83ccd4

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
name: test-deployment-info
33

44
on:
5-
push:
6-
branches-ignore:
7-
- main
5+
pull_request:
86

97
jobs:
108
test-action:
@@ -47,31 +45,31 @@ jobs:
4745
- name: Check `branch_tag_kebab`
4846
uses: nick-fields/assert-action@v1
4947
with:
50-
expected: ${{ env.GITHUB_REF_SLUG }}
48+
expected: refs-pull-${{ github.event.number }}-merge
5149
actual: ${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
5250

5351
- name: Check `image_latest_artifact`
5452
uses: nick-fields/assert-action@v1
5553
with:
56-
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:branch-${{ env.GITHUB_REF_SLUG }}-latest
54+
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:pull-${{ github.event.number }}-latest
5755
actual: ${{ steps.get-deployment-info.outputs.image_latest_artifact }}
5856

5957
- name: Check `image_latest_tag`
6058
uses: nick-fields/assert-action@v1
6159
with:
62-
expected: branch-${{ env.GITHUB_REF_SLUG }}-latest
60+
expected: pull-${{ github.event.number }}-latest
6361
actual: ${{ steps.get-deployment-info.outputs.image_latest_tag }}
6462

6563
- name: Check `image_version_artifact`
6664
uses: nick-fields/assert-action@v1
6765
with:
68-
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:branch-${{ env.GITHUB_REF_SLUG }}
66+
expected: europe-west6-docker.pkg.dev/my-test-project/my-affix/my-test-service:pull-${{ github.event.number }}
6967
actual: ${{ steps.get-deployment-info.outputs.image_version_artifact }}
7068

7169
- name: Check `image_version_tag`
7270
uses: nick-fields/assert-action@v1
7371
with:
74-
expected: branch-${{ env.GITHUB_REF_SLUG }}
72+
expected: pull-${{ github.event.number }}
7573
actual: ${{ steps.get-deployment-info.outputs.image_version_tag }}
7674

7775
- name: Check `short_sha`
@@ -95,11 +93,11 @@ jobs:
9593
- name: Check `revision_tag`
9694
uses: nick-fields/assert-action@v1
9795
with:
98-
expected: branch-${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
96+
expected: pull-${{ github.event.number }}
9997
actual: ${{ steps.get-deployment-info.outputs.revision_tag }}
10098

10199
- name: Check `revision_tag_slug`
102100
uses: nick-fields/assert-action@v1
103101
with:
104-
expected: branch-${{ steps.get-deployment-info.outputs.branch_tag_kebab }}
102+
expected: pull-${{ github.event.number }}
105103
actual: ${{ steps.get-deployment-info.outputs.revision_tag_slug }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3.10.7-slim
22

33
RUN apt-get update -y && apt-get install -y --fix-missing curl git && rm -rf /var/lib/apt/lists/*
44

5-
RUN pip3 install git+https://github.com/octue/[email protected].0
5+
RUN pip3 install git+https://github.com/octue/[email protected].1
66

77
COPY get_deployment_info/entrypoint.sh /entrypoint.sh
88

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ steps:
2525

2626
- name: Get deployment info
2727
id: get-deployment-info
28-
uses: octue/[email protected].0
28+
uses: octue/[email protected].1
2929
with:
3030
gcp_project_name: test-project
3131
gcp_project_number: 1234

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ outputs:
6363

6464
runs:
6565
using: "docker"
66-
image: "docker://octue/get-deployment-info:0.2.0"
66+
image: "docker://octue/get-deployment-info:0.2.1"
6767
args:
6868
- ${{ inputs.gcp_project_name }}
6969
- ${{ inputs.gcp_project_number }}

get_deployment_info/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if [ "$BRANCH_TAG_KEBAB" = "main" ]; then
4040
IMAGE_VERSION_TAG="$BRANCH_TAG_KEBAB-$REVISION_TAG"
4141
IMAGE_LATEST_TAG="$BRANCH_TAG_KEBAB-latest"
4242
else
43-
REVISION_TAG="branch-$BRANCH_TAG_KEBAB"
43+
REVISION_TAG=pull-$(echo $BRANCH_TAG_KEBAB | tr -d -c 0-9)
4444
IMAGE_VERSION_TAG="$REVISION_TAG"
4545
IMAGE_LATEST_TAG="$REVISION_TAG-latest"
4646
fi

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "get-deployment-info"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "A Github Action that gets the information required to build and deploy an Octue service."
55
authors = ["Marcus Lugg <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)