Bump peter-evans/create-pull-request from 6 to 7 #62
Workflow file for this run
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: On Push | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
jobs: | |
build-assets: | |
name: Build CV Assets | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up git repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install LaTeX packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y texlive-latex-base texlive-latex-recommended texlive-latex-extra | |
- name: Build assets | |
run: make | |
- name: Commit assets | |
if: ${{ github.event_name == 'push' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
add_options: -f | |
file_pattern: cv.pdf index.md | |
skip_dirty_check: true | |
skip_checkout: true | |
commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>' | |
commit_message: Updated GitHub Pages | |
branch: gh-pages | |
push_options: --force | |
check-role: | |
name: Check Role | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.check.outputs.changed }} | |
role: ${{ steps.details.outputs.role }} | |
company: ${{ steps.details.outputs.company }} | |
steps: | |
- name: Set up git repo | |
uses: actions/checkout@v4 | |
- name: Get current role and location | |
id: details | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
echo "existing=$(gh api user -q .bio)" >> $GITHUB_OUTPUT | |
echo "role=$(awk -v col=4 -f _src/role.awk _src/cv.tex)" >> $GITHUB_OUTPUT | |
echo "company=$(awk -v col=8 -f _src/role.awk _src/cv.tex)" >> $GITHUB_OUTPUT | |
- name: Compare roles | |
id: check | |
run: | | |
echo "Current: ${{ steps.details.outputs.existing }}" | |
echo "New: ${{ format('{0} at {1}', steps.details.outputs.role, steps.details.outputs.company) }}" | |
echo "changed=${{ toJSON(steps.details.outputs.existing != format('{0} at {1}', steps.details.outputs.role, steps.details.outputs.company)) }}" >> $GITHUB_OUTPUT | |
update-role: | |
name: Update Role | |
runs-on: ubuntu-latest | |
needs: check-role | |
if: ${{ github.event_name == 'push' && fromJSON(needs.check-role.outputs.changed) }} | |
steps: | |
- name: Update GitHub bio | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: gh api -X PATCH user -F "bio=${{ format('{0} at {1}', needs.check-role.outputs.role, needs.check-role.outputs.company) }}" | |
- name: Set up git repo for main site | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.repository_owner }}/${{ github.repository_owner }}.github.io | |
token: ${{ secrets.GH_TOKEN }} | |
path: ${{ github.workspace }}/site | |
- name: Update role | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: 'role:.*' | |
replace: 'role: ${{ needs.check-role.outputs.role }}' | |
include: site/_config.yml | |
- name: Update company | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: 'company:.*' | |
replace: 'company: ${{ needs.check-role.outputs.company }}' | |
include: site/_config.yml | |
- name: Create Pull Request | |
id: pull-request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
path: ${{ github.workspace }}/site | |
branch: role-${{ github.run_id }} | |
author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>' | |
commit-message: Update role from CV | |
title: Update role from CV | |
body: 'Updates role to match CV repository. See full diff: ${{ github.event.compare }}' | |
- name: Check Pull Request | |
if: steps.pull-request.outputs.pull-request-operation == '' | |
uses: actions/github-script@v7 | |
with: | |
script: core.setFailed('No Pull Request was created') |