Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR workflow #16

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: On Push
on:
push:
branches: main
pull_request:
branches: main

jobs:
build-assets:
name: Build CV Assets
Expand All @@ -12,10 +15,13 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}
- name: Install LaTeX packages
run: sudo apt-get install -y texlive-latex-base texlive-latex-recommended texlive-latex-extra
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
Expand All @@ -38,8 +44,10 @@ jobs:
uses: actions/checkout@v4
- name: Get current role and location
id: details
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
echo "existing=$(curl -sSu ${{ github.repository_owner }}:${{ secrets.GH_TOKEN }} $GITHUB_API_URL/user | jq -r .bio)" >> $GITHUB_OUTPUT
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
Expand All @@ -52,10 +60,12 @@ jobs:
name: Update Role
runs-on: ubuntu-latest
needs: check-role
if: ${{ fromJSON(needs.check-role.outputs.changed) }}
if: ${{ github.event_name == 'push' && fromJSON(needs.check-role.outputs.changed) }}
steps:
- name: Update GitHub bio
run: curl -X PATCH -sSu ${{ github.repository_owner }}:${{ secrets.GH_TOKEN }} $GITHUB_API_URL/user -d '{"bio":"${{ format('{0} at {1}', needs.check-role.outputs.role, needs.check-role.outputs.company) }}"}'
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: gh api --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:
Expand Down Expand Up @@ -84,7 +94,7 @@ jobs:
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.repository }}@${{ github.ref }}'
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
Expand Down