Skip to content

Commit 7c40449

Browse files
authored
Update sitemap.yml
name: Generate Sitemap on: push: branches: - main schedule: - cron: '0 0 * * 0' # 每周运行一次,可选 workflow_dispatch: # 允许手动触发 permissions: contents: write # 关键:授予推送代码的权限 jobs: sitemap: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Generate sitemap.xml uses: cicirello/generate-sitemap@v1 with: base-url-path: https://lg-leo.github.io/IG0606ADD-with-CAM-coursebook-NOTE/ # 排除不需要的文件类型(图片、样式等) exclude-file-extensions: "png,jpg,jpeg,gif,svg,ico,css,js,map,json,webmanifest" # 排除特定文件夹(如果有) exclude-paths: "images,assets" # 是否包含隐藏文件 include-hidden: false # 是否包含 .md 文件(会转换为 .html 链接) include-md: true - name: Commit and push changes run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add sitemap.xml git diff --staged --quiet || git commit -m "Auto-generate sitemap" git push
1 parent 91a706c commit 7c40449

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/sitemap.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ on:
55
branches:
66
- main
77
schedule:
8-
- cron: '0 0 * * 0'
8+
- cron: '0 0 * * 0' # 每周运行一次,可选
9+
workflow_dispatch: # 允许手动触发
910

10-
# 关键:授予写入仓库的权限
1111
permissions:
12-
contents: write
12+
contents: write # 关键:授予推送代码的权限
1313

1414
jobs:
1515
sitemap:
@@ -22,8 +22,14 @@ jobs:
2222
uses: cicirello/generate-sitemap@v1
2323
with:
2424
base-url-path: https://lg-leo.github.io/IG0606ADD-with-CAM-coursebook-NOTE/
25+
# 排除不需要的文件类型(图片、样式等)
2526
exclude-file-extensions: "png,jpg,jpeg,gif,svg,ico,css,js,map,json,webmanifest"
27+
# 排除特定文件夹(如果有)
28+
exclude-paths: "images,assets"
29+
# 是否包含隐藏文件
2630
include-hidden: false
31+
# 是否包含 .md 文件(会转换为 .html 链接)
32+
include-md: true
2733

2834
- name: Commit and push changes
2935
run: |

0 commit comments

Comments
 (0)