Skip to content

Commit 0166d42

Browse files
authored
Merge pull request #24101 from vvoland/cli-docs-closed
gha/sync-cli-docs: Ignore explicitly closed versions
2 parents b08475e + aabd3f9 commit 0166d42

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/sync-cli-docs.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,22 @@ jobs:
105105
> **Reviewer:** Please close and reopen this PR to trigger CI checks.
106106
> See: https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow#triggering-a-workflow-from-a-workflow
107107
run: |
108-
# Check for existing PR from this branch
109-
EXISTING_PR=$(gh pr list --state open --head "$BRANCH_NAME" --json url --jq ".[0].url")
108+
# Check for existing open PR from this branch
109+
EXISTING_PR=$(gh pr list --state open --head "$BRANCH_NAME" --json url --jq ".[0].url // empty")
110110
111111
if [ -n "$EXISTING_PR" ]; then
112112
echo "Updating existing PR: $EXISTING_PR" >> "$GITHUB_STEP_SUMMARY"
113113
git push -u origin "$BRANCH_NAME" --force
114114
gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY"
115115
else
116+
# Check if a closed PR with the same title already exists
117+
CLOSED_PR=$(gh pr list --state closed --search "$PR_TITLE in:title" --json url --jq ".[0].url // empty")
118+
if [ -n "$CLOSED_PR" ]; then
119+
echo "A closed PR already exists for this version: $CLOSED_PR" >> "$GITHUB_STEP_SUMMARY"
120+
echo "Skipping PR creation."
121+
exit 0
122+
fi
123+
116124
echo "Creating new PR" >> "$GITHUB_STEP_SUMMARY"
117125
git push -u origin "$BRANCH_NAME"
118126
gh pr create \

0 commit comments

Comments
 (0)