Skip to content

Commit d04cbb2

Browse files
committed
NRL-633 Revise env names
1 parent aed1c7d commit d04cbb2

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.github/workflows/pr-env-deploy.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ jobs:
2424
- name: Set a ID based on the branch name
2525
id: set_environment_id
2626
run: |
27-
JIRA_TICKET=$(echo '${{ github.event.pull_request.head.ref }}' | grep -Po --color=none '[A-z]{3,4}-[0-9]{3,5}' | tr '[:upper:]' '[:lower:]' || true)
28-
BRANCH_HASH=$(echo '${{ github.event.pull_request.head.ref }}' | sha256sum | head -c 6)
27+
JIRA_TICKET=$(
28+
echo '${{ github.event.pull_request.head.ref }}' | \
29+
grep -Po --color=none '[A-z]{3,4}-[0-9]{3,5}' | \
30+
sed 's/-//g' | \
31+
tr '[:upper:]' '[:lower:]' || \
32+
true
33+
)
34+
BRANCH_HASH=$(echo '${{ github.event.pull_request.head.ref }}${{ github.event.pull_request.id }}' | sha256sum | head -c 6)
2935
3036
if [ -z "$JIRA_TICKET" ]; then
31-
echo "environment_id=pr-${BRANCH_HASH}" > $GITHUB_OUTPUT
37+
echo "environment_id=${BRANCH_HASH}" > $GITHUB_OUTPUT
3238
else
33-
echo "environment_id=pr-${JIRA_TICKET}-${BRANCH_HASH}" > $GITHUB_OUTPUT
39+
echo "environment_id=${JIRA_TICKET}-${BRANCH_HASH}" > $GITHUB_OUTPUT
3440
fi
3541
outputs:
3642
environment_id: ${{ steps.set_environment_id.outputs.environment_id }}

.github/workflows/pr-env-destroy.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ jobs:
2424
- name: Set a ID based on the branch name
2525
id: set_environment_id
2626
run: |
27-
JIRA_TICKET=$(echo '${{ github.event.pull_request.head.ref }}' | grep -Po --color=none '[A-z]{3,4}-[0-9]{3,5}' | tr '[:upper:]' '[:lower:]' || true)
28-
BRANCH_HASH=$(echo '${{ github.event.pull_request.head.ref }}' | sha256sum | head -c 6)
27+
JIRA_TICKET=$(
28+
echo '${{ github.event.pull_request.head.ref }}' | \
29+
grep -Po --color=none '[A-z]{3,4}-[0-9]{3,5}' | \
30+
sed 's/-//g' | \
31+
tr '[:upper:]' '[:lower:]' || \
32+
true
33+
)
34+
BRANCH_HASH=$(echo '${{ github.event.pull_request.head.ref }}${{ github.event.pull_request.id }}' | sha256sum | head -c 6)
2935
3036
if [ -z "$JIRA_TICKET" ]; then
31-
echo "environment_id=pr-${BRANCH_HASH}" > $GITHUB_OUTPUT
37+
echo "environment_id=${BRANCH_HASH}" > $GITHUB_OUTPUT
3238
else
33-
echo "environment_id=pr-${JIRA_TICKET}-${BRANCH_HASH}" > $GITHUB_OUTPUT
39+
echo "environment_id=${JIRA_TICKET}-${BRANCH_HASH}" > $GITHUB_OUTPUT
3440
fi
3541
3642
outputs:

0 commit comments

Comments
 (0)