最新评论 - IEEE.ICU #144
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
# This workflow updates latest comments page | |
name: Update recently commented pages | |
on: | |
# these two events only take effect if this workflow is in master branch! | |
issue_comment: | |
types: [created] | |
issues: | |
types: [opened] | |
workflow_dispatch: # allow manual triggering | |
jobs: | |
update: | |
if: ${{ !github.event.issue.pull_request }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install PyGithub | |
run: pip3 install pygithub | |
- name: Generate recently commented pages | |
run: python3 gen_recently_commented.py ${{ secrets.MY_GITHUB_TOKEN }} > recent.md | |
- name: Git status | |
run: git status | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add recent.md | |
git commit -m "Auto update recently commented pages" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.MY_GITHUB_TOKEN }} | |
branch: master | |
- name: Git status | |
run: git status |