-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (43 loc) · 1.48 KB
/
fetch_update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Fetch update components
on:
push:
branches:
- main
- dev
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch:
jobs:
fetch-update-components-and-create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Fetch and update components (esp32s3)
env:
GIT_LFS_SKIP_SMUDGE: 1
run: python extras/scripts/fetch_components.py extras/configs/esp32.json --output ./src/components/
- name: Check for changes
id: check-for-changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if [ -n "$(git status --porcelain)" ]; then
git checkout -b update-branch
git add .
git commit -m "bot: fetch update components"
echo "##[set-output name=changes;]true"
else
echo "##[set-output name=changes;]false"
fi
- name: Push changes and create PR
if: steps.check-for-changes.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push --set-upstream origin update-branch -f
gh pr create --title "bot: fetch update components" --body "This PR was created automatically by GitHub Actions." --base main --head update-branch