This file contains hidden or 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-task-progress after pull request merged | |
on: | |
pull_request_target: | |
types: [closed] | |
branches: | |
- main # 或者你希望触发CI的分支名称 | |
jobs: | |
build: | |
if: github.event.pull_request.merged == true # 只有当pull request被合并时才执行CI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' # 替换为你需要的Python版本 | |
- name: Install dependencies | |
run: | | |
sudo apt install fonts-noto-cjk | |
python -m pip install --upgrade pip | |
pip install -r assets/requirements.txt # 如果你的项目有requirements.txt文件 | |
- name: Run Python script | |
run: | | |
python assets/update-task-progress.py # 替换为你需要运行的Python脚本 | |
- name: Commit changes and add changes | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update task progress" -a | |
# - name: Push changes | |
# run: | | |
# git push | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Push the changes | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
force: true | |