Skip to content

Generate README

Generate README #645

Workflow file for this run

# vim:ts=2:sts=2:sw=2:et
#
# Author: Hari Sekhon
# Date: 2022-03-27 19:45:33 +0100 (Sun, 27 Mar 2022)
#
# https://github.com/HariSekhon/CI-CD
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
#
# https://www.linkedin.com/in/HariSekhon
#
---
name: Generate README
on:
push:
branches:
- master
- main
paths:
- generate.sh
- .github/workflows/readme.yaml
pull_request:
branches:
- master
- main
paths:
- generate.sh
- .github/workflows/readme.yaml
workflow_dispatch:
inputs:
debug:
type: boolean
required: false
default: false
no_commit:
type: boolean
required: false
default: false
schedule:
- cron: '0 9 * * 1-5'
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DEBUG: ${{ ( github.event.inputs.debug != '' && github.event.inputs.debug != 'false' ) || '' }}
# schedule event has no inputs, so add literal false
NO_COMMIT: ${{ github.event.inputs.no_commit || 'false' }}
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
defaults:
run:
shell: bash -euxo pipefail {0}
jobs:
generate_readme:
if: github.event.repository.fork == false
name: Generate README
timeout-minutes: 10
runs-on: ubuntu-latest
container: harisekhon/bash-tools
steps:
- name: Git version
run: git --version
- uses: actions/checkout@v2
- name: Environment
run: env | sort
- name: Generate README.md
run: |
# use PAT token to iterate repos, then revert to regular transitory token to commit back to this repo following permissions key
export GITHUB_TOKEN="$GH_TOKEN"
./generate.sh
- name: Git Diff
run: |
git config --global --add safe.directory "$PWD"
git diff
- name: Git Commit
run: |
#git config user.name "$(git log -n 1 --format='%an')"
#git config user.email "$(git log -n 1 --format='%ae')"
git config user.name "GitHub Actions [bot]"
git config user.email "[email protected]"
if [ "$NO_COMMIT" = false ] &&
[ -n "$(git diff README.md)" ]; then
git commit --message "updated README.md - GitHub Actions Workflow: $GITHUB_WORKFLOW" README.md
fi
- name: Git Push
run: git push origin HEAD:"$GITHUB_REF"