Check links in README and generate badges #6
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: Check links in README and generate badges | |
on: | |
workflow_call: | |
push: | |
paths: | |
- '.github/workflows/check_readme.yaml' | |
- 'README.md' | |
schedule: | |
# run twice a month (on 1st and 15th of every month at 12:00 UTC) | |
- cron: '0 12 1,15 * *' | |
jobs: | |
linkinator: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run Linkinator | |
uses: JustinBeckwith/linkinator-action@v1 | |
badges: | |
runs-on: ubuntu-latest | |
needs: linkinator | |
if: '!cancelled()' | |
steps: | |
- name: Set values for failure badge | |
if: ${{ needs.linkinator.result == 'failure' }} | |
run: | | |
echo "MESSAGE=failing" >> $GITHUB_ENV | |
echo "COLOR=red" >> $GITHUB_ENV | |
- name: Set values for success badge | |
if: ${{ needs.linkinator.result == 'success' }} | |
run: | | |
echo "MESSAGE=passing - $(date --utc '+%b %d %Y at %R UTC')" >> $GITHUB_ENV | |
echo "COLOR=#44cc11" >> $GITHUB_ENV | |
- name: Create badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: ${{ vars.GIST_ID }} | |
filename: braille_display_readme_badge.json | |
label: Readme links check | |
message: ${{ env.MESSAGE }} | |
color: ${{ env.COLOR }} | |
style: flat-square |