diff --git a/.github/workflows/spec_update.yml b/.github/workflows/spec_update.yml index 0309c064..dc8a7645 100644 --- a/.github/workflows/spec_update.yml +++ b/.github/workflows/spec_update.yml @@ -84,6 +84,17 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt python generate_base_client.py + + - name: Close Old Pull Requests + if: steps.git-diff-num.outputs.num-diff != 0 + run: | + gh pr list --label "automated-spec-update" --state open --json number --jq '.[].number' | while read -r pr_num; do + echo "Closing old PR #$pr_num" + gh pr close "$pr_num" --delete-branch + done + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + - name: Create Pull Request id: create-pr uses: peter-evans/create-pull-request@v8 @@ -94,13 +105,12 @@ jobs: ${{ steps.git-diff.outputs.commit}} branch: ${{ steps.git-branch.outputs.branch }} delete-branch: true - title: 'Automated Spec Update' + title: 'Automated Spec Update - ${{ steps.current-time.outputs.formattedTime }}' body: | ${{ steps.git-diff.outputs.commit}} base: 'main' - team-reviewers: | - owners - maintainers + labels: | + automated-spec-update draft: false # - name: Enable Pull Request Automerge