cy0307 commited on
Commit
e0d7b7c
·
verified ·
1 Parent(s): 75874df

Keep automated star chart live on Pages

Browse files
Files changed (1) hide show
  1. .github/workflows/star-history.yml +10 -0
.github/workflows/star-history.yml CHANGED
@@ -7,6 +7,7 @@ on:
7
 
8
  permissions:
9
  contents: write
 
10
 
11
  concurrency:
12
  group: star-history-main
@@ -33,6 +34,7 @@ jobs:
33
  run: python scripts/build_star_history.py --snapshot
34
 
35
  - name: Commit an updated history
 
36
  run: |
37
  CHART_FILES=(
38
  assets/star-history.svg
@@ -46,6 +48,7 @@ jobs:
46
  data/star-history.json
47
  )
48
  if git diff --quiet -- "${CHART_FILES[@]}"; then
 
49
  echo "Star history is already current."
50
  exit 0
51
  fi
@@ -54,3 +57,10 @@ jobs:
54
  git add "${CHART_FILES[@]}"
55
  git commit -m "Refresh star history"
56
  git push
 
 
 
 
 
 
 
 
7
 
8
  permissions:
9
  contents: write
10
+ pages: write
11
 
12
  concurrency:
13
  group: star-history-main
 
34
  run: python scripts/build_star_history.py --snapshot
35
 
36
  - name: Commit an updated history
37
+ id: commit-history
38
  run: |
39
  CHART_FILES=(
40
  assets/star-history.svg
 
48
  data/star-history.json
49
  )
50
  if git diff --quiet -- "${CHART_FILES[@]}"; then
51
+ echo "changed=false" >> "$GITHUB_OUTPUT"
52
  echo "Star history is already current."
53
  exit 0
54
  fi
 
57
  git add "${CHART_FILES[@]}"
58
  git commit -m "Refresh star history"
59
  git push
60
+ echo "changed=true" >> "$GITHUB_OUTPUT"
61
+
62
+ - name: Publish the refreshed chart to GitHub Pages
63
+ if: steps.commit-history.outputs.changed == 'true'
64
+ env:
65
+ GH_TOKEN: ${{ github.token }}
66
+ run: gh api --method POST "repos/$GITHUB_REPOSITORY/pages/builds"