action.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. - name: Configure git user
  27. run: |
  28. slug="${{ steps.apptoken.outputs.app-slug }}"
  29. git config --global user.name "${slug}[bot]"
  30. git config --global user.email "${slug}[bot]@users.noreply.github.com"
  31. shell: bash
  32. - name: Clear checkout auth
  33. run: |
  34. git config --local --unset-all http.https://github.com/.extraheader || true
  35. shell: bash
  36. - name: Configure git remote
  37. run: |
  38. git remote set-url origin https://x-access-token:${{ steps.apptoken.outputs.token }}@github.com/${{ github.repository }}
  39. shell: bash