Skip to content

Commit 8fafb04

Browse files
authored
Merge branch 'main' into DGUK-290-move-markdown-render-to-docker-test
2 parents 5cc9317 + 925633d commit 8fafb04

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.github/workflows/create-pr.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
repository: alphagov/datagovuk_find
21-
- name: Create PR
21+
- name: Update integration SHA
2222
run: bash ./docker/create-pr.sh
2323
env:
2424
GH_TOKEN: ${{ secrets.PR_GITHUB_TOKEN }}
2525
GH_REF: ${{ github.ref_name }}
2626
IS_TAG: "false"
2727
ENVS: "integration"
28+
DIRECT_PUSH: "true"

docker/create-pr.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,27 @@ cd charts/charts/datagovuk/images
1919

2020
for ENV in $(echo $ENVS | tr "," " "); do
2121
(
22-
BRANCH="ci/${IMAGE_TAG}-${ENV}"
23-
24-
if git show-ref --quiet refs/heads/${BRANCH}; then
25-
echo "Branch ${BRANCH} already exists on govuk-dgu-charts"
26-
else
22+
cd "${ENV}"
23+
yq -i '.tag = env(IMAGE_TAG)' "find.yaml"
24+
yq -i '.branch = env(SOURCE_BRANCH)' "find.yaml"
25+
git add "find.yaml"
26+
27+
if [[ $(git status | grep "nothing to commit") ]]; then
28+
echo "Nothing to commit"
29+
elif [[ "${DIRECT_PUSH:-false}" == "true" ]]; then
30+
BRANCH="ci/${IMAGE_TAG}-${ENV}"
2731
git checkout -b ${BRANCH}
32+
git commit -m "Update datagovuk_find image tags for ${ENV} to ${IMAGE_TAG}"
33+
git push --set-upstream origin "${BRANCH}"
34+
PR_URL=$(gh pr create --title "Update datagovuk_find image tags for ${ENV} (${IMAGE_TAG})" --base main --head "${BRANCH}" --fill --repo alphagov/govuk-dgu-charts)
35+
gh pr merge "${PR_URL}" --merge --delete-branch
36+
else
37+
BRANCH="ci/${IMAGE_TAG}-${ENV}"
2838

29-
cd "${ENV}"
30-
yq -i '.tag = env(IMAGE_TAG)' "find.yaml"
31-
yq -i '.branch = env(SOURCE_BRANCH)' "find.yaml"
32-
git add "find.yaml"
33-
34-
if [[ $(git status | grep "nothing to commit") ]]; then
35-
echo "Nothing to commit"
39+
if git show-ref --quiet refs/heads/${BRANCH}; then
40+
echo "Branch ${BRANCH} already exists on govuk-dgu-charts"
3641
else
42+
git checkout -b ${BRANCH}
3743
git commit -m "Update datagovuk_find image tags for ${ENV} to ${IMAGE_TAG}"
3844
git push --set-upstream origin "${BRANCH}"
3945
gh pr create --title "Update datagovuk_find image tags for ${ENV} (${IMAGE_TAG})" --base main --head "${BRANCH}" --fill

0 commit comments

Comments
 (0)