From cc1cfdc5bafd1e1a87d4a7ba4f7e5fede222fafc Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sat, 28 Dec 2024 19:50:51 +0000 Subject: [PATCH 1/5] ci(releases): duplicate PR generation --- .github/workflows/update-releases.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index dbf7f8c55..f47fca6a8 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: @@ -32,7 +32,15 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: node release-notes-generator.js - - name: Create pull request + - 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') + echo "existing_pr_branch=$EXISTING_PR" >> $GITHUB_ENV + + - name: Create Pull Request + if: env.existing_pr_branch == '' uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} From b38f3e1725b16f0dd802c46e638e58186819d277 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sat, 28 Dec 2024 19:52:00 +0000 Subject: [PATCH 2/5] testing --- .github/workflows/update-releases.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index f47fca6a8..4fd6ac85e 100644 --- a/.github/workflows/update-releases.yml +++ b/.github/workflows/update-releases.yml @@ -1,8 +1,9 @@ name: Update Releases on: - schedule: - - cron: "0 */4 * * *" + push: + # schedule: + # - cron: "0 */4 * * *" permissions: contents: write @@ -10,7 +11,8 @@ permissions: jobs: update-releases: - if: github.repository == 'tailcallhq/tailcallhq.github.io' && github.ref == 'refs/heads/develop' + # if: github.repository == 'tailcallhq/tailcallhq.github.io' && github.ref == 'refs/heads/develop' + if: github.repository == 'tailcallhq/tailcallhq.github.io' runs-on: ubuntu-latest steps: From cbdc7bb08fbe0e8ecbca7b5cdeb333fac1441df9 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sat, 28 Dec 2024 20:07:26 +0000 Subject: [PATCH 3/5] testing --- .github/workflows/update-releases.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index 4fd6ac85e..bb5332a19 100644 --- a/.github/workflows/update-releases.yml +++ b/.github/workflows/update-releases.yml @@ -26,6 +26,19 @@ jobs: with: node-version: 20 + - name: Check for Existing Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + EXISTING_PRS=$(gh pr list --state open --base develop --json headRefName --jq '.[] | select(.headRefName | startswith("update-releases"))') + + if [ -n "$EXISTING_PRS" ]; then + echo "has_existing_pr=true" >> $GITHUB_ENV + exit 0 + else + echo "has_existing_pr=false" >> $GITHUB_ENV + fi + - name: Run npm Install run: npm install @@ -34,15 +47,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: node release-notes-generator.js - - 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') - echo "existing_pr_branch=$EXISTING_PR" >> $GITHUB_ENV - - name: Create Pull Request - if: env.existing_pr_branch == '' + if: env.has_existing_pr == 'false' uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} From 005318cf278934353d46e77e857254c249adede7 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sat, 28 Dec 2024 20:28:18 +0000 Subject: [PATCH 4/5] testing --- .github/workflows/update-releases.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index bb5332a19..7aefdc2d9 100644 --- a/.github/workflows/update-releases.yml +++ b/.github/workflows/update-releases.yml @@ -30,13 +30,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - EXISTING_PRS=$(gh pr list --state open --base develop --json headRefName --jq '.[] | select(.headRefName | startswith("update-releases"))') - - if [ -n "$EXISTING_PRS" ]; then - echo "has_existing_pr=true" >> $GITHUB_ENV - exit 0 + 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 "has_existing_pr=false" >> $GITHUB_ENV + echo "No existing PR found. Proceeding with new PR creation." fi - name: Run npm Install @@ -48,7 +47,6 @@ jobs: run: node release-notes-generator.js - name: Create Pull Request - if: env.has_existing_pr == 'false' uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} From d71c2022a92b4038a28534a47161919e66219ebc Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sat, 28 Dec 2024 20:30:15 +0000 Subject: [PATCH 5/5] revert: test changes --- .github/workflows/update-releases.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-releases.yml b/.github/workflows/update-releases.yml index 7aefdc2d9..d86bda438 100644 --- a/.github/workflows/update-releases.yml +++ b/.github/workflows/update-releases.yml @@ -1,9 +1,8 @@ name: Update Releases on: - push: - # schedule: - # - cron: "0 */4 * * *" + schedule: + - cron: "0 */4 * * *" permissions: contents: write @@ -11,8 +10,7 @@ permissions: jobs: update-releases: - # if: github.repository == 'tailcallhq/tailcallhq.github.io' && github.ref == 'refs/heads/develop' - if: github.repository == 'tailcallhq/tailcallhq.github.io' + if: github.repository == 'tailcallhq/tailcallhq.github.io' && github.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: