action.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. name: "Setup Git Committer"
  2. description: "Create app token and configure git user"
  3. inputs:
  4. opencode-app-id:
  5. description: "OpenCode GitHub App ID"
  6. required: true
  7. opencode-app-secret:
  8. description: "OpenCode GitHub App private key"
  9. required: true
  10. outputs:
  11. token:
  12. description: "GitHub App token"
  13. value: ${{ steps.apptoken.outputs.token }}
  14. app-slug:
  15. description: "GitHub App slug"
  16. value: ${{ steps.apptoken.outputs.app-slug }}
  17. runs:
  18. using: "composite"
  19. steps:
  20. - name: Create app token
  21. id: apptoken
  22. uses: actions/create-github-app-token@v2
  23. with:
  24. app-id: ${{ inputs.opencode-app-id }}
  25. private-key: ${{ inputs.opencode-app-secret }}
  26. owner: ${{ github.repository_owner }}
  27. - name: Configure git user
  28. run: |
  29. slug="${{ steps.apptoken.outputs.app-slug }}"
  30. git config --global user.name "${slug}[bot]"
  31. git config --global user.email "${slug}[bot]@users.noreply.github.com"
  32. shell: bash
  33. - name: Clear checkout auth
  34. run: |
  35. git config --local --unset-all http.https://github.com/.extraheader || true
  36. shell: bash
  37. - name: Configure git remote
  38. run: |
  39. git remote set-url origin https://x-access-token:${{ steps.apptoken.outputs.token }}@github.com/${{ github.repository }}
  40. shell: bash