Skip to content

Commit fd323af

Browse files
committed
--fixup
1 parent 49cb919 commit fd323af

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/get-dependents.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,20 @@ jobs:
3939
4040
- name: Create and push branch with changes
4141
run: |
42+
BRANCH_NAME="update-filtered-data-${{ github.ref_name }}"
43+
44+
# Check if branch exists locally and delete it
45+
if git branch --list "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
46+
git branch -D "$BRANCH_NAME"
47+
fi
48+
49+
# Check if branch exists on remote and delete it
50+
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
51+
git push origin --delete "$BRANCH_NAME"
52+
fi
53+
4254
# Create and switch to new branch
43-
git checkout -b update-filtered-data-${{ github.ref_name }}
55+
git checkout -b "$BRANCH_NAME"
4456
4557
# Add changes
4658
git add ./data/govuk-frontend-dependents.json
@@ -55,7 +67,7 @@ jobs:
5567
git commit -m "Get latest filtered dependents data and rejections - ${{ github.ref_name }}"
5668
5769
# Push branch
58-
git push origin update-filtered-data-${{ github.ref_name }}
70+
git push origin "$BRANCH_NAME"
5971
6072
- name: Create or update pull request
6173
run: |

0 commit comments

Comments
 (0)