Skip to content

Beautify my GitHub Contribution #316

Beautify my GitHub Contribution

Beautify my GitHub Contribution #316

name: Beautify my GitHub Contribution
on:
workflow_dispatch:
schedule:
- cron: '5 0 * * *'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
contributors: ${{ steps.get-contributor-list.outputs.contributors }}
steps:
- name: Get current date
run: |
date +%Y/%m/%d-%H:%M:%S
echo "TODAY=$(date +%Y/%m/%d)" >>$GITHUB_ENV
# echo "TODAY=test" >>$GITHUB_ENV
- uses: actions/checkout@v3
- id: get-contributor-list
run: |
CONTRIBUTORS=($(cat scheduler/${{ env.TODAY }}/CONTRIBUTORS | tr a-z A-Z | tr '-' '_'))
printf '%s\n' "${CONTRIBUTORS[@]}" | jq -R . | jq -s .
echo contributors=$(printf '%s\n' "${CONTRIBUTORS[@]}" | jq -R . | jq -s .) >>$GITHUB_OUTPUT
contribute:
runs-on: ubuntu-latest
needs: prepare
if: "join(fromJSON(needs.prepare.outputs.contributors), '') != ''"
strategy:
max-parallel: 1
matrix:
contributor: ${{fromJSON(needs.prepare.outputs.contributors)}}
steps:
- name: Get current date
run: |
date +%Y/%m/%d-%H:%M:%S
echo "TODAY=$(date +%Y/%m/%d)" >>$GITHUB_ENV
- run: |
CONTRIBUTOR=`echo "${{ matrix.contributor }}"`
# echo ${{ secrets[format('USER_PAT_{0}', matrix.contributor)] }} | sed 's/./& /g'
echo CONTRIBUTOR_PAT=${{ secrets[format('USER_PAT_{0}', matrix.contributor)] }} >>$GITHUB_ENV
- name: Update GitHub Profile README
continue-on-error: true
uses: theboi/github-update-readme@v1.0
env:
GITHUB_TOKEN: ${{ env.CONTRIBUTOR_PAT }}
with:
header: "Hey, guys! 👋"
subhead: "Contribution log for beautifying your GitHub contribution graph."
footer: ${{ env.TODAY }} - ${{ matrix.contributor }} - ${{ github.event_name }}
path: CONTRIBUTION.md
repoCount: 0