Update Leaderboard #1155
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 Leaderboard | ||
| on: | ||
| schedule: | ||
| - cron: '5 * * * *' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| update-readme: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| - name: Fetch leaderboard | ||
| env: | ||
| LB_SERVER: ${{ secrets.LB_SERVER }} | ||
| id: fetch-leaderboard | ||
| run: | | ||
|
Check failure on line 23 in .github/workflows/update-leaderboard.yaml
|
||
| curl -s ${{ LB_SERVER }} -o leaderboard.json | ||
| - name: Update README.md | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_EMAIL: ${{ secrets.GH_EMAIL }} | ||
| GH_NAME: ${{ secrets.GH_NAME }} | ||
| run: | | ||
| leaderboard=$(cat leaderboard.json) | ||
| leaderboard_content=$(jq -r '. | to_entries | map("\(.key + 1). \(.value.team_name): \(.value.points)") | join("\n")' leaderboard.json) | ||
| awk -v content="$leaderboard_content" 'BEGIN {found=0} /<!-- LEADERBOARD_START -->/ {print; print content; found=1; next} /<!-- LEADERBOARD_END -->/ {found=0} !found' README.md > README.tmp && mv README.tmp README.md | ||
| git config --global user.email "${{ secrets.GH_EMAIL }}" | ||
| git config --global user.name "${{ secrets.GH_NAME }}" | ||
| git add README.md leaderboard.json | ||
| git commit -m "Update leaderboard" | ||
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/ByteXync/Commit-And-Conquer.git | ||