From ad54b51b087971b113f95f4863ddf08ba06c2534 Mon Sep 17 00:00:00 2001 From: Gabriel Feo Date: Mon, 24 Apr 2023 12:16:52 +0100 Subject: [PATCH] Don't push to existing PRs --- .github/workflows/check-new-api-spec.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-new-api-spec.yml b/.github/workflows/check-new-api-spec.yml index 5728be5f..6d11b91f 100644 --- a/.github/workflows/check-new-api-spec.yml +++ b/.github/workflows/check-new-api-spec.yml @@ -33,11 +33,19 @@ jobs: echo "NEW_VERSION=$(cat new.txt)" >> $GITHUB_ENV fi rm new.txt || true + - name: Check for existing PR + if: ${{ env.NEW_VERSION }} + run: | + set -u + echo "UPDATE_BRANCH='feature/api-spec-$NEW_VERSION'" >> $GITHUB_ENV + if git ls-remote --exit-code --heads origin "$UPDATE_BRANCH"; then + echo "EXISTING_PR=true" >> $GITHUB_ENV + fi - name: 'Create PR' - if: ${{ !inputs.dry_run && env.NEW_VERSION }} + if: ${{ !inputs.dry_run && env.NEW_VERSION && !env.EXISTING_PR }} uses: peter-evans/create-pull-request@v5 with: - branch: "feature/api-spec-${{ env.NEW_VERSION }}" + branch: "${{ env.UPDATE_BRANCH }}" commit-message: "Bump GE API spec version to ${{ env.NEW_VERSION }}" title: "Bump GE API spec version to ${{ env.NEW_VERSION }}" body: "https://docs.gradle.com/enterprise/api-manual/#release_history"