s0 / git-publish-subdir-action

GitHub Action to push a subdirectory as a branch to any git repo (e.g. for GitHub Pages)
https://github.com/marketplace/actions/push-git-subdirectory-as-branch
MIT License
208 stars 36 forks source link

Add `USERNAME` and `EMAIL` env variables #75

Closed ozaner closed 1 year ago

ozaner commented 2 years ago

Added support for a custom username and email to be used in the autogenerated commit. Just set USERNAME and EMAIL respectively in the env variables.

Context

The autogenerated commit this action produces always uses the username and email of the pusher. This commit adds support for changing these variables using the USERNAME and EMAIL environment variables. My particular use case was to mark these autogenerated commits as being created by the github-actions bot:

- name: Commit to Output
  uses: s0/git-publish-subdir-action@develop
  env:
    REPO: self
    BRANCH: output
    FOLDER: outputDir
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    USERNAME: "github-actions[bot]"
    EMAIL: "github-actions[bot]@users.noreply.github.com"

Checklist

s0 commented 2 years ago

Hiya, thanks for the contribution, this is a nice addition.

Before we can get this merged in though, we need to add a few things to this PR:

I can help you with any of the above or do it myself, but happy to let you have a go if you'd prefer to do it?

ozaner commented 2 years ago

I've updated the readme, regenerated the action code, and added a unit test. Not too familiar with typescript (or even javascript) so I might be missing something.

promise commented 2 years ago

@s0 bump

s0 commented 2 years ago

(also sorry for not including these change requests in the first review, I had some time to think about the naming and only remembered after I saw it in my notifications again)

ozaner commented 2 years ago

The USERNAME and EMAIL env variables have been renamed, and the readme updated.