ajoberstar / gradle-git-publish

Gradle plugin for publishing to Git repositories
Apache License 2.0
95 stars 16 forks source link

Override commit author #81

Closed scordio closed 4 years ago

scordio commented 4 years ago

We recently integrated your plugin with GitHub Actions to publish the AssertJ documentation. One tiny side effect is that each commit now appears authored from a runner user which comes from Actions infrastructure, it would be nice to override it with the user who triggered the workflow (see assertj/doc#32).

Is there a way to set the author name and email? An environment property or system property would be ideal, like the grgit auth parameters.

Thanks for these awesome projects 🙂

ajoberstar commented 4 years ago

Curently there's no way to do this, but will mark it as a future enhancement.

chkpnt commented 4 years ago

You can also set the global git author informations. At least, the following GitHub Action is working for me 🙂

...
jobs:
  update-data:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ssh-key: ${{ secrets.WORKFLOW_SSH_KEY }}
      - uses: webfactory/ssh-agent@v0.3.0
        with:
          ssh-private-key: ${{ secrets.WORKFLOW_SSH_KEY }}
      - name: Set up Java environment
        uses: actions/setup-java@v1
        with:
          java-version: 11
      - name: Set Git author information
        run: |
          git config --global user.name "chkpnt CI"
          git config --global user.email "chkpnt-ci@chkpnt.de"
      - name: Push data, if there are any changes
        run: ./gradlew gitPublishPush --info
scordio commented 4 years ago

No idea why I didn't think about that, thanks for the hint @chkpnt!