update graph.html #18848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'update graph.html' | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 6' | |
#- cron: '24 17 11 12 1' | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
name: '${{ matrix.os }}: run' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT_WORKSPACES }} | |
path: getactionusage | |
- uses: actions/checkout@v4 | |
name: Fetch the web site repo to update. | |
with: | |
token: ${{ secrets.PAT_WORKSPACES }} | |
repository: lukka/lukka.github.io | |
path: lukkagithubio | |
ref: main | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
#- run: | | |
# npm install | |
# npm run build/pack | |
- uses: ./getactionusage | |
name: Scan GitHub public repositories | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_WORKSPACES }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: results | |
path: ${{ github.workspace }}/getactionusage/graph/action-usage-db.json | |
- name: Check for modified files | |
id: git-check | |
run: echo "modified=$(if [ -n "$(cd getactionusage && git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT | |
- name: Commit DB content and update CRON job | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
cd getactionusage | |
git config --global user.name 'Luca' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.PAT_WORKSPACES }}@github.com/${{ github.repository }} | |
git add -A | |
git add -f ./graph/action-usage-db.json | |
git status | |
git commit -m "Automated commit for DB JSON file and updated CRON job" | |
git push | |
- name: Publish updated network graph | |
if: steps.git-check.outputs.modified == 'true' | |
shell: bash | |
run: | | |
cd lukkagithubio | |
git config --global user.name 'Luca' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.PAT_WORKSPACES }}@github.com/lukka/lukka.github.io | |
mkdir -pv ./graph/ | |
cp ../getactionusage/graph/action-usage-db.json ./graph | |
cp ../getactionusage/graph/graph.html ./graph | |
git add -f ./graph/action-usage-db.json | |
git add -f ./graph/graph.html | |
git status | |
git commit -m "Automated commit for publishing updated graph web page" | |
git push |