Skip to content

Update Leaderboard #1155

Update Leaderboard

Update Leaderboard #1155

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

View workflow run for this annotation

GitHub Actions / Update Leaderboard

Invalid workflow file

The workflow is not valid. .github/workflows/update-leaderboard.yaml (Line: 23, Col: 14): Unrecognized named-value: 'LB_SERVER'. Located at position 1 within expression: LB_SERVER
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