Skip to content

refactor: replace inline chart implementation with dynamic EarningsCh… #114

refactor: replace inline chart implementation with dynamic EarningsCh…

refactor: replace inline chart implementation with dynamic EarningsCh… #114

name: Pull Request Automation
on:
pull_request:
types: [opened, ready_for_review]
jobs:
build-design-system:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Cache Bun dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-dependencies-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-dependencies-
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
working-directory: ./packages/design-system
run: bun install
- name: Run build script
working-directory: ./packages/design-system
run: bun run build
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update design system tokens"
branch: ${{ github.head_ref }}
file_pattern: ./packages/design-system/**
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
add-reviewer:
runs-on: ubuntu-latest
needs: build-design-system
steps:
- name: Extract Issue Number from Branch
id: extract_issue
run: |
BRANCH_NAME="${{ github.head_ref }}"
ISSUE_NUMBER=$(echo "$BRANCH_NAME" | grep -oE '[0-9]+' | head -1)
if [ -z "$ISSUE_NUMBER" ]; then
echo "No issue number found in branch name!"
exit 1
fi
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Add Reviewer
run: |
curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \
-d '{"reviewers":["mrbadri"]}'
- name: Update PR Description
run: |
PR_BODY="## Related Issue
Closes #${{ env.ISSUE_NUMBER }}"

Check failure on line 76 in .github/workflows/pull-request-review.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/pull-request-review.yml

Invalid workflow file

You have an error in your yaml syntax on line 76
curl -X PATCH -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
-d "{\"body\": \"$PR_BODY\"}"
merge-pr:
runs-on: ubuntu-latest
needs: add-reviewer
steps:
- name: Check PR Author
id: check-author
run: |
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
echo "PR_AUTHOR=${PR_AUTHOR}" >> $GITHUB_ENV
if [[ "$PR_AUTHOR" == "mrbadri" ]]; then
echo "MERGE_IMMEDIATELY=true" >> $GITHUB_ENV
else
echo "MERGE_IMMEDIATELY=false" >> $GITHUB_ENV
fi
- name: Wait for Approval (if not mrbadri)
id: check-approval
if: env.MERGE_IMMEDIATELY == 'false'
run: |
APPROVED=0
while [ $APPROVED -eq 0 ]; do
echo "Checking for approvals..."
REVIEWS=$(curl -s -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews)
if echo "$REVIEWS" | grep -q '"state": "APPROVED"'; then
APPROVED=1
echo "Pull request has at least one approval!"
else
echo "Waiting for at least one approval..."
sleep 60
fi
done
# - name: Merge Pull Request
# run: |
# curl -X PUT -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
# -H "Accept: application/vnd.github.v3+json" \
# https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge \
# -d '{"merge_method":"squash"}'