File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : One-time Dataset license fix
2+
3+ on :
4+ push :
5+ paths :
6+ - " .github/workflows/fix-dataset-license.yml"
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ fix :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v7
16+
17+ - name : Add CC BY 4.0 license to aggregate Dataset JSON-LD
18+ run : |
19+ python - <<'PY'
20+ from pathlib import Path
21+
22+ path = Path("lib/jsonld.ts")
23+ text = path.read_text()
24+ needle = ''' creator: { "@id": ORG_ID },
25+ isAccessibleForFree : true,
26+ keywords : [
27+ ' ''
28+ replacement = '' ' creator: { "@id": ORG_ID },
29+ isAccessibleForFree : true,
30+ license : " https://creativecommons.org/licenses/by/4.0/" ,
31+ keywords : [
32+ ' ''
33+ count = text.count(needle)
34+ if count != 1:
35+ raise SystemExit(f"Expected exactly one aggregate Dataset target, found {count}")
36+ path.write_text(text.replace(needle, replacement, 1))
37+ PY
38+
39+ rm .github/workflows/fix-dataset-license.yml
40+
41+ - name: Commit fix and remove one-time workflow
42+ run: |
43+ git config user.name "github-actions[bot]"
44+ git config user.email "github-actions[bot]@users.noreply.github.com"
45+ git add lib/jsonld.ts .github/workflows/fix-dataset-license.yml
46+ git commit -m "fix: add Dataset license structured data [skip ci]"
47+ git push
You can’t perform that action at this time.
0 commit comments