1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- name: "Update Preview Dependencies (feat/v2)"
- on:
- schedule:
- - cron: "0 */3 * * *" # every three hours
- workflow_dispatch:
- jobs:
- update:
- runs-on: ubuntu-latest
- steps:
- - name: Cancel Previous Runs
- uses: styfle/cancel-workflow-action@0.9.1
- with:
- access_token: ${{ github.token }}
- - name: Checkout
- uses: actions/checkout@v2.3.5
- with:
- ref: 'feat/v2'
- - name: Setup Node.js 18.x
- uses: actions/setup-node@v2
- with:
- node-version: 18.x
- - name: Remove yarn.lock
- run: rm yarn.lock
- - 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.PAT_TOKEN }}
- with:
- title: "chore(feat/v2): updated preview dependencies"
- body: "This PR updates preview dependencies to the latest versions."
- branch: "chore/update-preview"
- branch-suffix: "timestamp"
- base: "feat/v2"
- add-paths: yarn.lock
|