mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 19:37:36 +08:00
ci: 添加cmdpriv-template.json的自动化生成脚本
This commit is contained in:
48
.github/workflows/update-cmdpriv-template.yml
vendored
Normal file
48
.github/workflows/update-cmdpriv-template.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Update cmdpriv-template
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'pkg/qqbot/cmds/**'
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
paths:
|
||||||
|
- 'pkg/qqbot/cmds/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-cmdpriv-template:
|
||||||
|
if: github.event.pull_request.merged == true || github.event_name == 'push'
|
||||||
|
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: Install dependencies
|
||||||
|
run: pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Run generate_cmdpriv_template.py
|
||||||
|
run: python3 generate_cmdpriv_template.py
|
||||||
|
|
||||||
|
- name: Check for changes in cmdpriv-template.json
|
||||||
|
id: check_changes
|
||||||
|
run: |
|
||||||
|
if git diff --name-only | grep -q "cmdpriv-template.json"; then
|
||||||
|
echo "::set-output name=changes_detected::true"
|
||||||
|
else
|
||||||
|
echo "::set-output name=changes_detected::false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit changes to cmdpriv-template.json
|
||||||
|
if: steps.check_changes.outputs.changes_detected == 'true'
|
||||||
|
run: |
|
||||||
|
git config --global user.name "GitHub Actions Bot"
|
||||||
|
git config --global user.email "<github-actions@github.com>"
|
||||||
|
git add cmdpriv-template.json
|
||||||
|
git commit -m "Update cmdpriv-template.json"
|
||||||
|
git push
|
||||||
Reference in New Issue
Block a user