Repository navigation
59 lines (52 loc) · 2.05 KB
/
Copy pathrefresh.yml
File metadata and controls
59 lines (52 loc) · 2.05 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
name: Refresh profile
# No pull_request / pull_request_target triggers: PRs (including from forks)
# can never start this workflow, so they can never reach either provider token.
on:
schedule:
- cron: "0 */3 * * *" # every 3 hours: 00:00, 03:00 ... 21:00 UTC (GitHub may start it a few minutes late)
workflow_dispatch:
push:
branches: [main]
paths:
- "scripts/**"
- "tests/**"
- ".github/workflows/refresh.yml"
permissions:
contents: write # only to commit the regenerated SVGs
concurrency:
group: refresh-profile
cancel-in-progress: true
jobs:
refresh:
# Never run in forks or on other branches.
if: github.repository == 'endercodezz/endercodezz' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# Pinned to a commit SHA (v7.0.1). This step sees neither provider token.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Unit tests
# Offline (fake GitHub API); runs without any token.
run: python3 -m unittest discover -s tests
- name: Render panels
# The secret is scoped to this single step, which runs only our own
# stdlib script: no third-party code ever sees it. GitHub masks it in
# logs; the script never prints it and aborts if it appears in output.
env:
GH_TOKEN: ${{ secrets.STATS_TOKEN || secrets.GITHUB_TOKEN }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_MIRRORS: ${{ secrets.GITEA_MIRRORS }}
GH_USER: ${{ github.repository_owner }}
PROFILE_TZ: ${{ vars.PROFILE_TZ || 'UTC' }}
run: python3 scripts/generate.py
- name: Commit if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add assets README.md
if git diff --cached --quiet; then
echo "No changes."
else
git commit -m "chore: refresh profile stats"
git push
fi