Skip to content

Commit

Permalink
Merge pull request #1120 from andrew-bierman/feat/refresh-lockfile-bot
Browse files Browse the repository at this point in the history
Feat/refresh lockfile bot
  • Loading branch information
andrew-bierman authored Jul 22, 2024
2 parents 925a1d1 + f39fbdd commit 8dc6377
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/refresh-lockfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Refresh Lockfile

on:
issue_comment:
types: [created]

jobs:
refresh-lockfile:
if: github.event.issue.pull_request != null && contains(github.event.comment.body, '/refresh-lockfile')
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Setup Standard Environment
uses: ./.github/actions/setup-standard-environment
with:
expo-token: ${{ secrets.EXPO_TOKEN }}

- name: Post start comment
run: |
gh pr comment ${{ github.event.issue.number }} --body "Starting lockfile refresh..."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Refresh lockfile
run: yarn regen

- name: Verify changes
run: git status

- name: Commit changes if there are any
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add yarn.lock
git commit -m 'Refresh lockfile'
git push
gh pr comment ${{ github.event.issue.number }} --body "Lockfile refreshed and changes committed."
else
gh pr comment ${{ github.event.issue.number }} --body "No changes to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Post completion comment
if: always()
run: |
gh pr comment ${{ github.event.issue.number }} --body "Lockfile refresh process completed."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8dc6377

Please sign in to comment.