Update snake.yml #22
This file contains 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: Generate snake animation | ||
on: | ||
schedule: # execute every 12 hours | ||
- cron: "0 */12 * * *" | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
- name: Generate snake.svg | ||
run: | | ||
# Fetch contributions data using GitHub API | ||
curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/orgs/sankacrew/stats/contributors" \ | ||
-o contributors.json | ||
# Parse JSON data to extract contributions | ||
# Example: Extract contribution counts for each member | ||
# (Replace this with your preferred method) | ||
cat contributors.json | # Parse JSON data to extract contributions | ||
jq '.[] | {login: .author.login, contributions: .total}' contributors.json > contributions.txt | ||
# Use contributions data to generate snake.svg (modify as needed) | ||
# Example: Use contributions to generate a custom snake animation | ||
python generate_snake.py contributions.txt > dist/snake.svg | ||
- name: Push snake.svg to output branch | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: snake-svg | ||
path: dist/snake.svg |