update graph.html #18926
This file contains hidden or 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 DB content | |
| id: action-usage-db-check | |
| run: echo "modified=$(if [ -n "$(cd getactionusage && git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT | |
| - name: Check for modified graph.html | |
| id: graph-html-check | |
| shell: bash | |
| run: | | |
| # Check if the graph.html file has been modified by comparing the two files | |
| if ! diff -q ./getactionusage/graph/graph.html ./lukkagithubio/graph/graph.html; then | |
| echo "modified=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "modified=false" >> $GITHUB_OUTPUT | |
| fi | |
| continue-on-error: true | |
| - name: Commit DB content and update CRON job | |
| if: steps.action-usage-db-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 | |
| continue-on-error: true | |
| - name: Publish updated network graph | |
| if: steps.graph-html-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/graph.html ./graph | |
| git add -f ./graph/graph.html | |
| git status | |
| git commit -m "Automated commit for publishing updated graph web page" | |
| git push | |
| continue-on-error: true |