42. 接雨水 #4
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_readme | |
on: | |
workflow_dispatch: | |
issues: | |
types: [ opened, edited, labeled, unlabeled ] | |
issue_comment: | |
types: [ created, edited ] | |
push: | |
branches: | |
- master | |
paths: | |
- main.py | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
if: github.repository_owner_id == github.event.issue.user.id || github.event_name == 'push' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests PyGithub | |
- name: Get issue data and update README.md | |
run: python main.py --issue_number '${{ github.event.issue.number }}' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push readme | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add backup/*.md | |
git commit -a -m 'update new record' || echo "nothing to commit" | |
git push || echo "nothing to push" |