X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.github%2Fworkflows%2Fclone-count.yml;h=43119339ba527a8b35fc0f5bc05c43523ba56d8c;hb=23c97c471a4b7194aaac0620e935341de07eb1ad;hp=8ae1af0873a10b4249e115f1486b5621115a2c27;hpb=c41ef1e0e9242c0404d067dea8072bdae3419e5c;p=e-mobility-charging-stations-simulator.git diff --git a/.github/workflows/clone-count.yml b/.github/workflows/clone-count.yml index 8ae1af08..43119339 100644 --- a/.github/workflows/clone-count.yml +++ b/.github/workflows/clone-count.yml @@ -1,4 +1,4 @@ -name: GitHub Clone Count Update Everyday +name: GitHub Clone Count Update on: schedule: @@ -6,11 +6,11 @@ on: workflow_dispatch: jobs: - build: + clone-count: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: gh login run: echo "${{ secrets.SECRET_TOKEN }}" | gh auth login --with-token @@ -23,26 +23,26 @@ jobs: > clone.json - name: create gist and download previous count - id: set_id + id: set-gist run: | if gh secret list | grep -q "GIST_ID" then echo "GIST_ID found" - echo ::set-output name=GIST::${{ secrets.GIST_ID }} + echo "GIST=${{ secrets.GIST_ID }}" >> $GITHUB_OUTPUT curl https://gist.githubusercontent.com/${{ github.actor }}/${{ secrets.GIST_ID }}/raw/clone.json > clone_before.json if cat clone_before.json | grep '404: Not Found'; then echo "GIST_ID not valid anymore. Creating another gist..." gist_id=$(gh gist create clone.json | awk -F / '{print $NF}') echo $gist_id | gh secret set GIST_ID - echo ::set-output name=GIST::$gist_id + echo "GIST=${gist_id}" >> $GITHUB_OUTPUT cp clone.json clone_before.json - git rm --ignore-unmatch CLONE.md + git rm --ignore-unmatch CLONE.md fi else echo "GIST_ID not found. Creating a gist..." gist_id=$(gh gist create clone.json | awk -F / '{print $NF}') echo $gist_id | gh secret set GIST_ID - echo ::set-output name=GIST::$gist_id + echo "GIST=${gist_id}" >> $GITHUB_OUTPUT cp clone.json clone_before.json fi @@ -58,11 +58,11 @@ jobs: curl -s -X PATCH \ --user "${{ github.actor }}:${{ secrets.SECRET_TOKEN }}" \ -H "Content-Type: application/json" \ - -d @post_clone.json https://api.github.com/gists/${{ steps.set_id.outputs.GIST }} > /dev/null 2>&1 + -d @post_clone.json https://api.github.com/gists/${{ steps.set-gist.outputs.GIST }} > /dev/null 2>&1 if [ ! -f CLONE.md ]; then shields="https://img.shields.io/badge/dynamic/json?color=success&label=Clone&query=count&url=" - url="https://gist.githubusercontent.com/${{ github.actor }}/${{ steps.set_id.outputs.GIST }}/raw/clone.json" + url="https://gist.githubusercontent.com/${{ github.actor }}/${{ steps.set-gist.outputs.GIST }}/raw/clone.json" repo="https://github.com/MShawon/github-clone-count-badge" echo ''> CLONE.md echo ' @@ -78,13 +78,13 @@ jobs: echo "GitHub Clones" >> CLONE.md echo '```' >> CLONE.md + git config --local user.name "GitHub Action" + git config --local user.email "action@github.com" git add CLONE.md - git config --global user.name "GitHub Action" - git config --global user.email "action@github.com" - git commit -m "create clone count badge" + git commit -m "docs: create clone count badge" fi - - name: Push - uses: ad-m/github-push-action@master + - name: push + uses: CasperWA/push-protected@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.SECRET_TOKEN }}