From a216bd12adab2610bb3e07ad062c86af2e895c57 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sun, 29 Dec 2024 12:51:25 +0530 Subject: [PATCH] fix(releases): duplicate PR generation (#587) * ci(releases): duplicate PR generation * testing * testing * testing * revert: test changes --- .github/workflows/update-releases.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index dbf7f8c55..d86bda438 100644 --- a/.github/workflows/update-releases.yml +++ b/.github/workflows/update-releases.yml @@ -10,7 +10,7 @@ permissions: jobs: update-releases: - if: github.ref == 'refs/heads/develop' + if: github.repository == 'tailcallhq/tailcallhq.github.io' && github.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: @@ -24,6 +24,18 @@ jobs: with: node-version: 20 + - name: Check for Existing Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + EXISTING_PR=$(gh pr list --state open --base develop --json headRefName --jq '.[] | select(.headRefName | startswith("update-releases")) | .headRefName') + if [ -n "$EXISTING_PR" ]; then + echo "An existing PR is already open. Exiting workflow." + exit 1 + else + echo "No existing PR found. Proceeding with new PR creation." + fi + - name: Run npm Install run: npm install @@ -32,7 +44,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: node release-notes-generator.js - - name: Create pull request + - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }}