|
7 | 7 | jobs: |
8 | 8 | build: |
9 | 9 | runs-on: ubuntu-latest |
| 10 | + permissions: |
| 11 | + contents: write # 新增:赋予写入内容的权限 |
| 12 | + |
10 | 13 | steps: |
11 | | - - uses: actions/checkout@v2 |
12 | | - - uses: actions/setup-python@v1 |
| 14 | + - uses: actions/checkout@v4 # 升级到最新版本 |
| 15 | + - uses: actions/setup-python@v5 # 升级到最新版本 |
13 | 16 | with: |
14 | | - python-version: 3.10.18 |
| 17 | + python-version: '3.10' # 简化版本号,使用最新的3.10.x |
| 18 | + |
15 | 19 | - name: install python modules |
16 | 20 | run: pip install flake8 markdown pypinyin |
17 | 21 | #- name: format code |
18 | | - # run: flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics |
| 22 | + # run: flake8 . --count --select=E9,F63,F72,F82 --show- |
19 | 23 | - name: generate information |
20 | 24 | run: | |
21 | 25 | python3 utils/genReadme.py |
22 | 26 | python3 utils/genIndex.py |
| 27 | + |
23 | 28 | - name: git config |
24 | 29 | run: | |
25 | | - git config --global user.name "mbinary" |
| 30 | + git config --global user.name "heqin-zhu" |
26 | 31 | git config --global user.email "[email protected]" |
| 32 | + |
27 | 33 | - name: generate pages and push to gh-pages branch |
28 | | - env: |
29 | | - ACCESS_TOKEN: ${{secrets.ACCESS_TOKEN}} |
30 | 34 | run: | |
31 | 35 | cd docs |
32 | 36 | git init |
33 | | - git remote add origin [email protected]:USTC-Resource/USTC-Course.git |
| 37 | + # 使用HTTPS协议而非SSH,避免密钥问题 |
| 38 | + git remote add origin https://github.com/USTC-Resource/USTC-Course.git |
34 | 39 | git add --all |
35 | 40 | export TZ='Asia/Shanghai' |
36 | | - git commit -m "Update webpages at `date +%Y-%m-%d,%H:%m` UTC+8" |
37 | | - git push -f "https://${ACCESS_TOKEN}@github.com/USTC-Resource/USTC-Course" master:gh-pages |
38 | | - |
| 41 | + git commit -m "Update webpages at `date +%Y-%m-%d,%H:%M` UTC+8" # 修复时间格式错误(%m改为%M) |
| 42 | + |
| 43 | + # 使用GitHub官方令牌和推荐的认证格式 |
| 44 | + git push -f "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/USTC-Resource/USTC-Course.git" HEAD:gh-pages |
0 commit comments