-
Notifications
You must be signed in to change notification settings - Fork 5
69 lines (60 loc) · 2.53 KB
/
sitemap.yml
File metadata and controls
69 lines (60 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
68
69
name: GitHub Pages - Generate XML sitemap
# Trigger the workflow manually
on:
workflow_dispatch:
concurrency:
group: sitemap-${{ github.ref }}
cancel-in-progress: false
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@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.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@6a56a20238e631d653600cf792c3596722b78259 # v1.10.4
with:
base-url-path: https://nick2bad4u.github.io/UserStyles
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@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
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 }}