update-profile-daily #311
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: update-profile-daily | |
on: | |
# Run automatically everyday at 21:00 | |
schedule: | |
- cron: "0 21 * * *" | |
# Allows to manually run the job at any time | |
workflow_dispatch: | |
# Run on every push on the main branch | |
push: | |
branches: [ "main" ] | |
# Only a single workflow in the same concurrency will run at the same time | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
update_github_profile_readme: | |
runs-on: ubuntu-latest | |
name: Generate awesome wallpapers, random quotes, grid snake animation | |
permissions: | |
contents: write | |
timeout-minutes: 10 | |
steps: | |
# Checkout main branch | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
# with: | |
# sparse-checkout: assets | |
# Generate awesome wallpapers, output wallpaper.jpg at <assets> folder | |
- name: Generate awesome wallpapers | |
id: wallpaper | |
uses: huuquyet/generate-awesome-wallpapers@main | |
env: | |
HF_API_TOKEN: ${{ secrets.HF_API_TOKEN }} | |
with: | |
random: true | |
# Get random quotes from The Tale of Kieu - Nguyen Du, output random-kieu.svg at <assets> folder | |
- name: Get random quotes from The Tale of Kieu | |
id: kieu | |
uses: huuquyet/random-tale-of-kieu@main | |
# Generate a snake game from a github user (<github_user_name>) contributions graph, output a svg animation at <assets> folder | |
# the content will be available at main branch after push step | |
- name: Generate assets github-contribution-grid-snake.svg | |
id: snake | |
uses: Platane/snk/svg-only@v3 | |
with: | |
github_user_name: ${{ github.repository_owner }} | |
outputs: | | |
assets/github-contribution-grid-snake.svg | |
assets/github-contribution-grid-snake-dark.svg?palette=github-dark | |
# Push awesome wallpapers, random quotes & grid snake animation to main branch | |
# Note: the following account information will not work on GHES | |
- name: Push awesome wallpapers, random quotes and grid snake animation to main branch | |
id: push | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m ":robot: Generated awesome wallpaper, quotes & grid snake animation [skip ci]" | |
git push | |
# Update WakaTime stats between START_SECTION:waka and END_SECTION:waka blocks in README.md | |
- name: Update README.md with WakaTime stats | |
id: waka | |
uses: athul/waka-readme@master | |
with: | |
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} | |
SHOW_TITLE: true | |
CODE_LANG: rust | |
COMMIT_MESSAGE: ":robot: Updated the WakaTime stats [skip ci]" | |
rerun-failed-jobs: | |
runs-on: ubuntu-latest | |
name: Rerun failed jobs in the current workflow | |
needs: [ update_github_profile_readme ] | |
timeout-minutes: 10 | |
if: failure() | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
- name: Rerun failed jobs in the current workflow | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh run cancel ${{ github.run_id }} | |
JOB_ID=$(gh run view ${{ github.run_id }} --json jobs --jq '.jobs[0].databaseId') | |
gh run rerun --job $JOB_ID --repo ${{ github.repository }} --failed |