Update: 计算机网络 #9
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: Transfer Images | |
on: | |
push: | |
paths: | |
- 'docs/**/*.md' | |
jobs: | |
image_transfer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: pip install requests | |
- name: Run image transfer script | |
env: | |
API_TOKEN: ${{ secrets.API_TOKEN }} | |
UPLOAD_URL: ${{ secrets.UPLOAD_URL }} | |
run: python transform.py | |
- name: Configure Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --quiet; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
- name: Commit and push changes | |
if: steps.check_changes.outputs.changes == 'true' | |
run: | | |
git add . | |
git commit -m "Update image links" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |