Skip to content

Commit

Permalink
feat: use same permissions used at repo checkout
Browse files Browse the repository at this point in the history
closes #115
  • Loading branch information
xsc27 committed Sep 28, 2021
1 parent 9cd3405 commit c82c3a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
20 changes: 16 additions & 4 deletions README.md
Expand Up @@ -4,7 +4,7 @@ This action will bump version, tag commit and generate a changelog with conventi

## Inputs

- **Required** `github-token`: Github token.
- **Optional** `github-token`: Github token, if different permissions required than from checkout.
- **Optional** `git-message`: Commit message that is used when committing the changelog.
- **Optional** `git-user-name`: The git user.name to use for the commit. Default `Conventional Changelog Action`
- **Optional** `git-user-email`: The git user.email to use for the commit. Default `conventional.changelog.action@github.com`
Expand Down Expand Up @@ -56,9 +56,9 @@ A bunch of useful environment variables are available to the script with `proces
### Pre-Changelog-Generation hook

> Function in a specified file will be run right before the changelog generation phase, when the next
> version is already known, but it was not used anywhere yet. It can be useful if you want to manually update version or tag.
> version is already known, but it was not used anywhere yet. It can be useful if you want to manually update version or tag.
Same restrictions as for the pre-commit hook, but exported functions names should be `preVersionGeneration` for modifications to the version and `preTagGeneration` for modifications to the git tag.
Same restrictions as for the pre-commit hook, but exported functions names should be `preVersionGeneration` for modifications to the version and `preTagGeneration` for modifications to the git tag.

Following props will be passed to the function as a single parameter and same output is expected:

Expand All @@ -73,7 +73,7 @@ export function preTagGeneration(tag: string): string {}
### Config-File-Path
A config file to define the conventional commit settings. Use it if you need to override values like `issuePrefix` or `issueUrlFormat`. If you set a `config-file-path`, the `preset` setting will be ignored. Therefore use an existing config and override the values you want to adjust.

example:
example:
```javascript
'use strict'
const config = require('conventional-changelog-conventionalcommits');
Expand Down Expand Up @@ -188,6 +188,18 @@ Github releases
body: ${{ steps.changelog.outputs.clean_changelog }}
```

Use a deploy key

```yaml
- name: Checkout GitHub Action
uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_DEPLOY_KEY }}
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
```

## Development

If you'd like to contribute to this project, all you need to do is clone and install [act](https://github.com/nektos/act) this project and run:
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -12,7 +12,7 @@ branding:
inputs:
github-token:
description: 'Github token'
required: true
required: false

git-message:
description: 'Commit message to use'
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/git.js
Expand Up @@ -11,7 +11,7 @@ module.exports = new (class Git {
commandsRun = []

constructor() {
const githubToken = core.getInput('github-token', { required: true })
const githubToken = core.getInput('github-token')

// Make the Github token secret
core.setSecret(githubToken)
Expand All @@ -37,7 +37,9 @@ module.exports = new (class Git {
this.config('user.email', gitUserEmail)

// Update the origin
this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`)
if (githubToken) {
this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`)
}
}

/**
Expand Down

0 comments on commit c82c3a1

Please sign in to comment.