Skip to content

Commit d1efff5

Browse files
committed
fix: add check for existing PR before creating Docker version update PR
1 parent f5bdbb9 commit d1efff5

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

.github/workflows/github-docker-registry-push.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,27 @@ jobs:
6565
if git diff --cached --quiet; then
6666
echo "No changes to docker-versions.txt, skipping PR creation"
6767
else
68-
git commit -m "chore: update Docker versions"
69-
git push origin "$BRANCH_NAME"
70-
# Create PR with explicit title and body instead of --fill
71-
gh pr create \
72-
--title "chore: update Docker versions" \
73-
--body "Automated update of docker-versions.txt with current Docker and Docker Compose versions." \
74-
--base main \
75-
--head "$BRANCH_NAME"
68+
# Check if an open PR already exists
69+
EXISTING_PR=$(gh pr list --base main --state open --search "chore: update Docker versions in:title" --json number --jq '.[0].number // empty')
70+
if [ -n "$EXISTING_PR" ]; then
71+
echo "Open PR #$EXISTING_PR already exists for Docker version updates, skipping PR creation"
72+
echo "You can view it at: $(gh pr view $EXISTING_PR --json url --jq '.url')"
73+
else
74+
git commit -m "chore: update Docker versions"
75+
git push origin "$BRANCH_NAME"
76+
# Create PR with explicit title and body instead of --fill
77+
gh pr create \
78+
--title "chore: update Docker versions" \
79+
--body "Automated update of docker-versions.txt with current Docker and Docker Compose versions.
80+
81+
**Changes:**
82+
- Updated Docker version information
83+
- Updated Docker Compose version information
84+
85+
This PR only contains changes to \`docker-versions.txt\` and no other files." \
86+
--base main \
87+
--head "$BRANCH_NAME"
88+
fi
7689
fi
7790

7891
- name: Check for Dockerfile and context changes

0 commit comments

Comments
 (0)