From 4a3105bd6ed54f017d55c06ff4e50b9d90752f82 Mon Sep 17 00:00:00 2001 From: Chris Buckley Date: Mon, 22 Jul 2024 17:16:54 +0000 Subject: [PATCH 1/4] Add pull_request to workflow --- .github/workflows/push.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index feada3b..4483951 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 @@ -16,6 +19,7 @@ jobs: - name: Build assets run: make - name: Commit assets + if: ${{ github.event_name == 'push' }} uses: stefanzweifel/git-auto-commit-action@v5 with: add_options: -f @@ -52,7 +56,7 @@ 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) }}"}' From 2d706d0487b3cf08fbdc8b6637d3fa571d5fae84 Mon Sep 17 00:00:00 2001 From: Chris Buckley Date: Mon, 22 Jul 2024 17:22:04 +0000 Subject: [PATCH 2/4] apt-get update --- .github/workflows/push.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4483951..0437e2f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,7 +15,9 @@ 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 From 5c21e56c0b1d9278709d8adf3e37b32df5b07685 Mon Sep 17 00:00:00 2001 From: Chris Buckley Date: Mon, 22 Jul 2024 18:01:59 +0000 Subject: [PATCH 3/4] Link to compare view in PR for updated role --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0437e2f..581cf12 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -90,7 +90,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 From 8c77ac86667e1f79a0e6275776bcd9f27c5fd761 Mon Sep 17 00:00:00 2001 From: Chris Buckley Date: Mon, 22 Jul 2024 18:16:56 +0000 Subject: [PATCH 4/4] Use gh api instead of curl --- .github/workflows/push.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 581cf12..57247f9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -44,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 @@ -61,7 +63,9 @@ jobs: 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: