-
Notifications
You must be signed in to change notification settings - Fork 5
67 lines (59 loc) · 2.53 KB
/
sitemap.yml
File metadata and controls
67 lines (59 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: GitHub Pages - Generate XML sitemap
# Trigger the workflow manually or on a schedule (every day at midnight)
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
jobs:
sitemap_job:
runs-on: ubuntu-latest
name: Generate a sitemap
steps:
# Step to harden the runner for security purposes
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
disable-sudo: true
egress-policy: audit
allowed-endpoints: >
github.com:443
# Step to checkout the repository
- name: Checkout the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
# Step to generate the sitemap using the cicirello/generate-sitemap action
- name: Generate the sitemap
id: sitemap
uses: cicirello/generate-sitemap@eb8db82126ee30619883c8c43e8c49ec14ebd6dc # v1.10.1
with:
base-url-path: https://userstyles.github.typpi.online/
additional-extensions: doc docx ppt pptx js css json xml xlsx xls pdf md markdown txt lua yaml yml png
# Step to output the sitemap generation stats for debugging and verification
- name: Output stats
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
# Step to create a pull request with the new sitemap
- name: Create Pull Request with new SiteMap
id: create_pr
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
title: "Automated sitemap update"
body: >
Sitemap updated by the [generate-sitemap](https://github.com/cicirello/generate-sitemap)
GitHub action. Automated pull-request generated by the
[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action.
# Step to set the pull request number or ID as an environment variable
- name: Set pull request number or ID
id: set_pr_number
run: |
pr_number=$(gh pr list --state open --base main --json number -q '.[0].number')
if [ -n "$pr_number" ]; then
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
else
echo "PR_NUMBER=" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}