Skip to content

Commit

Permalink
Use github app to push changes (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonddim authored Sep 6, 2024
1 parent edf7fc0 commit ac29afe
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/mixins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@ jobs:
mixins:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true

- name: Update Jsonnet dependencies
if: ${{ github.actor == 'renovate[bot]' }}
run: make vendor
env:
JB_ARGS: update

- name: Render mixins
run: make
env:
JB_ARGS: update

- name: Get status
run: echo "changed=$(git status --short | grep -c -E "docs|jsonnetfile.lock.json")" >> "$GITHUB_OUTPUT"
run: echo "changed=$(git status --short | grep -c "docs/")" >> "$GITHUB_OUTPUT"
id: status

- name: Push changes
if: ${{ github.actor == 'renovate[bot]' && steps.status.outputs.changed !=0 }}
run: |
USER_ID=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)
git add docs jsonnetfile.lock.json
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
git config --global user.email "${USER_ID}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>"
git commit -m "Update files after Renovate update"
git push origin HEAD:refs/heads/${{ github.event.pull_request.head.ref }}
Expand Down

0 comments on commit ac29afe

Please sign in to comment.