修复ci首次新增app-meta.json时不会更新的问题 #3
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: update app-meta.json | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'app-meta.json' | |
- '.github/workflows/app-meta-update.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set variables | |
run: | | |
echo "app_meta=https://raw.githubusercontent.com/LuckyPray/XAutoDaily/master/app-meta.json" >> $GITHUB_ENV | |
- name: Clone pages branch | |
uses: actions/checkout@v3.3.0 | |
with: | |
ref: pages | |
- name: Update app-meta.json | |
run: | | |
curl -sSL ${app_meta} > app-meta.json | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
if [[ -n $(git status -s) ]]; then | |
git commit -m "Update app-meta.json" | |
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@${{ github.repository }}" pages:pages | |
fi |