Procházet zdrojové kódy

apply changes on v2 CI

Shahed Nasser před 1 rokem
rodič
revize
f0925f5622
1 změnil soubory, kde provedl 27 přidání a 1 odebrání
  1. 27 1
      .github/workflows/update-preview-deps.yml

+ 27 - 1
.github/workflows/update-preview-deps.yml

@@ -28,11 +28,37 @@ jobs:
 
       - name: Install Dependencies
         run: yarn
+        
+      - name: Close Previous PRs
+        shell: "bash"
+        run: |
+          TITLE="chore(feat/v2): updated preview dependencies"
+          
+          # Get the list of pull requests with the specified title
+          PR_LIST=$(gh pr list --search "$TITLE in:title" --json number)
+          
+          echo "$PR_LIST"
+          
+          # Check if any pull requests were found
+          if [ -z "$PR_LIST" ]; then
+            echo "No pull requests found with the title: $TITLE"
+            exit 0
+          fi
+          
+          # Close each pull request
+          echo "$PR_LIST" | jq -r '.[].number' | while read -r PR_NUMBER; do
+            echo "Closing pull request #$PR_NUMBER"
+            gh pr close "$PR_NUMBER"
+          done
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          OWNER: ${{ github.repository_owner }}
+          REPO: ${{ github.event.repository.name }}
 
       - name: Open PR with changes
         uses: peter-evans/create-pull-request@v5
         env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
         with:
           title: "chore(feat/v2): updated preview dependencies"
           body: "This PR updates preview dependencies to the latest versions."