Go #351
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: Go | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21.4" | |
- name: Install dependencies | |
run: go get . | |
- name: Cleanup outputs | |
run: rm README.md Snippets.md | |
- name: Build | |
run: go build -o=generator ./*.go | |
- name: Generate outputs | |
run: ./generator > README.md 2> Snippets.md | |
- name: Check difference | |
id: diff | |
run: git diff --name-only --exit-code README.md Snippets.md | |
continue-on-error: true | |
- name: Commit outputs | |
if: steps.diff.outcome == 'failure' | |
run: | | |
set -x | |
git config user.name "progfay" | |
git config user.email "[email protected]" | |
git remote set-url origin https://progfay:${{ secrets.GITHUB_TOKEN }}@github.com/progfay/shields-with-icon | |
git add README.md Snippets.md | |
git commit -m 'doc: update README.md, Snippets.md (auto-generated)' | |
git push origin master |