Repository navigation
85 lines (75 loc) · 2.55 KB
/
Copy pathrefresh.yml
File metadata and controls
85 lines (75 loc) · 2.55 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Refresh issue data
on:
schedule:
- cron: "17 5,17 * * *" # twice a day, 05:17 and 17:17 UTC
workflow_dispatch:
inputs:
languages:
description: "Test run on a comma-separated subset of languages. Test runs do not commit or deploy."
required: false
default: ""
force:
description: "Publish even if far fewer issues were found than last time"
type: boolean
default: false
permissions:
contents: read
concurrency:
group: refresh
cancel-in-progress: false
jobs:
refresh:
runs-on: ubuntu-latest
timeout-minutes: 330
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Test the pipeline
run: python -m unittest discover scripts
- name: Collect issues
env:
# Prefer a fine-grained personal access token with public read access (secret RADAR_TOKEN):
# the built-in token has a much lower API rate limit, so full runs take hours.
GITHUB_TOKEN: ${{ secrets.RADAR_TOKEN || github.token }}
LANGUAGES: ${{ inputs.languages }}
FORCE: ${{ inputs.force && '--force' || '' }}
run: |
if [ -n "$LANGUAGES" ]; then
python scripts/radar.py all --languages "$LANGUAGES"
else
python scripts/radar.py all $FORCE
fi
- name: Summary
run: |
python - <<'PY' >> "$GITHUB_STEP_SUMMARY"
import json
data = json.load(open("data/issues.json"))
print(f"**{len(data['issues'])}** issues from **{len(data['repositories'])}** projects, generated {data['generated_at']}")
PY
- name: Commit updated data
if: ${{ !inputs.languages }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md issues projects data
if git diff --cached --quiet; then
echo "No changes."
else
git commit -m "data: refresh issues $(date -u +'%Y-%m-%d %H:%M UTC')"
git pull --rebase --autostash
git push
fi
- uses: actions/configure-pages@v6
if: ${{ !inputs.languages }}
- uses: actions/upload-pages-artifact@v5
if: ${{ !inputs.languages }}
with:
path: site
- uses: actions/deploy-pages@v5
if: ${{ !inputs.languages }}