X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=.github%2Fworkflows%2Fclone-count.yml;h=cc067e88a8481d6f6afeda6099dc5bf4bd9675ae;hb=2f22c19f4f784984e53efe84f7a5a9ff125e8c8f;hp=72574c5d72f3626ea1d3bc3dc4e2949f9839f142;hpb=3848c42989e06b10344bbfa5bd2ef0c253f7d9f9;p=e-mobility-charging-stations-simulator.git diff --git a/.github/workflows/clone-count.yml b/.github/workflows/clone-count.yml index 72574c5d..cc067e88 100644 --- a/.github/workflows/clone-count.yml +++ b/.github/workflows/clone-count.yml @@ -2,7 +2,7 @@ name: GitHub Clone Count Update Everyday on: schedule: - - cron: "0 */24 * * *" + - cron: '0 */24 * * *' workflow_dispatch: jobs: @@ -10,8 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - + - uses: actions/checkout@v3 + - name: gh login run: echo "${{ secrets.SECRET_TOKEN }}" | gh auth login --with-token @@ -28,21 +28,21 @@ jobs: 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 @@ -51,7 +51,7 @@ jobs: curl https://raw.githubusercontent.com/MShawon/github-clone-count-badge/master/main.py > main.py python3 main.py - - name: Update gist with latest count + - name: update gist with latest count run: | content=$(sed -e 's/\\/\\\\/g' -e 's/\t/\\t/g' -e 's/\"/\\"/g' -e 's/\r//g' "clone.json" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') echo '{"description": "${{ github.repository }} clone statistics", "files": {"clone.json": {"content": "'"$content"'"}}}' > post_clone.json @@ -77,7 +77,7 @@ jobs: ```html' >> CLONE.md echo "GitHub Clones" >> CLONE.md echo '```' >> CLONE.md - + git add CLONE.md git config --global user.name "GitHub Action" git config --global user.email "action@github.com" @@ -85,6 +85,6 @@ jobs: fi - name: Push - uses: ad-m/github-push-action@master + uses: CasperWA/push-protected@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.SECRET_TOKEN }}