Updated Resume #65
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 About | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
schedule: | |
# - cron: "0 0 1 * *" | |
- cron: '*/10 * * * *' # just for testing | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Git config | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Setup for PR | |
run: | | |
git fetch origin ${{ github.event.pull_request.head.ref }} | |
git reset --hard origin/${{ github.event.pull_request.head.ref }} | |
- name: Update about and about_template | |
run: | | |
# replace date, time, and time offset in template | |
sed -ri "s/[12][0-9]{3}-[01][0-9]-[0-3][0-9]/$(date '+%Y-%m-%d')/g" _pages/about_template.md | |
sed -ri "s/[01][0-9]:[0-5][0-9]:[0-5][0-9]/$(date '+%T')/g" _pages/about_template.md | |
sed -ri "s/\+[0-9]{4}/$(date '+%z')/g" _pages/about_template.md | |
# clone cschindlbeck, get about and concatenate it to template | |
git clone https://github.com/cschindlbeck/cschindlbeck.git | |
cat _pages/about_template.md cschindlbeck/README.md > _pages/about.md | |
- name: Add and commit the changed files | |
run: | | |
git add _pages/about.md | |
git add _pages/about_template.md | |
# Prevent empty add to result in error | |
git diff-index --quiet HEAD || git commit -m "Updated about" | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Push HEAD to PR branch | |
run: | | |
git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
- if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} | |
name: Push on push or schedule | |
run: | | |
git push |