diff --git a/.github/workflows/bumpgen-core.yml b/.github/workflows/bumpgen-core.yml index e654858..0dab179 100644 --- a/.github/workflows/bumpgen-core.yml +++ b/.github/workflows/bumpgen-core.yml @@ -23,3 +23,4 @@ jobs: with: path: "./packages/bumpgen-core/" llm_key: ${{ secrets.LLM_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index 1b83391..121fb18 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,9 @@ inputs: llm_key: description: "LLM API key" required: true + github_token: + description: "GitHub token" + required: true runs: using: "composite" @@ -25,15 +28,22 @@ runs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - shell: bash - name: Check for changes and commit + - name: Check for changes and commit + id: commit_changes env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ inputs.github_token }} run: | git add -u if ! git diff-index --quiet HEAD; then git commit -m "chore: run bumpgen" - git push origin HEAD:${GITHUB_REF#refs/heads/} + echo "::set-output name=changes_detected::true" else echo "No changes to commit" - fi + echo "::set-output name=changes_detected::false" + + - name: Push changes + if: steps.commit_changes.outputs.changes_detected == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ inputs.github_token }} + branch: ${{ github.ref }}