-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (32 loc) · 1.11 KB
/
screenshot.yml
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
name: Screenshot Website
on:
schedule:
- cron: "0 */23 * * *"
jobs:
screenshot:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Get github pages URL
id: pages_url
run: |
REPO_NAME=$(echo "${{ github.repository }}" | awk -F'/' '{print $2}')
echo "::set-output name=url::https://${{ github.repository_owner }}.github.io/$REPO_NAME/"
- name: Generate screenshot
id: "screenshot"
uses: natainditama/screen-snap@main
with:
url: "${{ steps.pages_url.outputs.url }}"
fileName: ".github/screnshot.png"
- name: Commit changes
# Only run this step if screenshot path is not empty
if: steps.screenshot.outputs.path != ''
uses: EndBug/add-and-commit@v9
with:
message: "docs: update ${{ steps.screenshot.outputs.path }}"
add: "${{ steps.screenshot.outputs.path }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}