diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index feada3b..57247f9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -2,6 +2,9 @@ name: On Push on: push: branches: main + pull_request: + branches: main + jobs: build-assets: name: Build CV Assets @@ -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 @@ -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 @@ -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: @@ -84,7 +94,7 @@ jobs: author: 'github-actions[bot] ' 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