chore: update ci #7
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
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 |