From 3ab4329978c6041c274c097fe6ec1436cb9cfc03 Mon Sep 17 00:00:00 2001 From: trueberryless Date: Tue, 19 Nov 2024 12:09:31 +0100 Subject: [PATCH] update needs deploy --- .github/workflows/sync.yaml | 24 ++++++++++++++++-------- repos.json | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 0f4e7ec..316d8aa 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -78,7 +78,7 @@ jobs: cd target-repo # Create or switch to the branch - branch_name="update-workflows-$(date +%Y%m%d)" + branch_name="update-workflows" echo "Creating branch $branch_name..." git checkout -b "$branch_name" || git checkout "$branch_name" @@ -106,13 +106,21 @@ jobs: git commit -m "Update GitHub workflow files" git push --force origin "$branch_name" - # Create a pull request - echo "Creating pull request for $repo_name..." - gh pr create \ - --base main \ - --head "$branch_name" \ - --title "Sync workflow files" \ - --body "This PR syncs the specified GitHub workflow files from the central repository." + # Check for existing pull request + echo "Checking for an open PR for branch $branch_name..." + existing_pr=$(gh pr list --base main --head "$branch_name" --json number --jq '.[0].number') + + if [ -n "$existing_pr" ]; then + echo "Found existing PR #$existing_pr. Updating it..." + gh pr comment "$existing_pr" --body "The branch has been updated with the latest changes." + else + echo "No existing PR found. Creating a new one..." + gh pr create \ + --base main \ + --head "$branch_name" \ + --title "Sync workflow files" \ + --body "This PR syncs the specified GitHub workflow files from the central repository." + fi fi # Cleanup diff --git a/repos.json b/repos.json index de581bd..0e81405 100644 --- a/repos.json +++ b/repos.json @@ -2,7 +2,7 @@ "repositories": [ { "name": "trueberryless-org/starlight-view-modes", - "needs": ["welcome-bot.yaml"] + "needs": ["release.yaml", "welcome-bot.yaml"] } ] }