Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/refresh_yarn_lockfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Refresh yarn lockfile

on:
schedule:
# Every Tuesday at 10:00 UTC (8:30AM IST)
- cron: "30 10 * * 2"
# Every Wednesday at 03:00 (8:30AM IST)
- cron: "0 3 * * 3"

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -39,6 +39,7 @@ jobs:
needs: prepare

strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.prepare.outputs.branches) }}

Expand Down Expand Up @@ -100,13 +101,22 @@ jobs:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
if gh pr view "$BRANCH" --repo "${{ github.repository }}" >/dev/null 2>&1; then
echo "PR already exists for ${BRANCH}"
else
OPEN_PRS=$(gh pr list \
--repo "${{ github.repository }}" \
--head "$BRANCH" \
--state open \
--json number \
--jq 'length')

if [[ "$OPEN_PRS" -gt 0 ]]; then
echo "An open PR already exists for ${BRANCH}"
exit 0
fi

gh pr create \
--base "${{ matrix.branch }}" \
--head "$BRANCH" \
--title "chore: regenerate yarn.lock" \
--title "chore: regenerate yarn.lock - ${{ matrix.branch }}" \
--body "This PR was created automatically from Refresh yarn lockfile Github Action.

Changes:
Expand All @@ -115,4 +125,3 @@ jobs:
- Regenerated yarn.lock" \
--label "dependencies" \
--label "automated"
fi
Loading