mirror of
https://github.com/mivodev/mivodev.github.io.git
synced 2026-01-26 13:32:07 +07:00
feat(automation): add registry generation script and github action
This commit is contained in:
43
.github/workflows/update-registry.yml
vendored
Normal file
43
.github/workflows/update-registry.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Update Plugin Registry
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Run daily at midnight
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write # Needed to push changes
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
|
||||
- name: Generate Registry
|
||||
run: php scripts/generate_registry.php
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check for Changes
|
||||
id: check_changes
|
||||
run: |
|
||||
if [[ -n $(git status -s public/plugins.json) ]]; then
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Commit and Push
|
||||
if: steps.check_changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
git config --global user.name 'github-actions[bot]'
|
||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||
git add public/plugins.json
|
||||
git commit -m "chore(registry): update plugins.json [skip ci]"
|
||||
git push
|
||||
Reference in New Issue
Block a user