-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1120 from andrew-bierman/feat/refresh-lockfile-bot
Feat/refresh lockfile bot
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |