docs(readme): Path can be relative or absolute for pre-commit input
parent
afea49fa57
commit
677ff927a4
10
README.md
10
README.md
|
@ -26,14 +26,13 @@ This action will bump version, tag commit and generate a changelog with conventi
|
||||||
> version is already known and a new changelog has been generated. You can run any chores across your
|
> version is already known and a new changelog has been generated. You can run any chores across your
|
||||||
> repository that should be added and commited with the release commit.
|
> repository that should be added and commited with the release commit.
|
||||||
|
|
||||||
An absolute path to the `.js` script file must be provided when specifying the `pre-commit` hook. File
|
Specified path could be relative or absolute. If it is relative, then it will be based on the `GITHUB_WORKSPACE` path.
|
||||||
should contain all its dependencies bundled in itself just like for the webapp.
|
|
||||||
|
|
||||||
Script should:
|
Script should:
|
||||||
- be a CommonJS module
|
- be a CommonJS module
|
||||||
- have a single export: `exports.preCommit = (props) => { /* ... */ }`
|
- have a single export: `exports.preCommit = (props) => { /* ... */ }`
|
||||||
- not have any return value
|
- not have any return value
|
||||||
- be bundled
|
- be bundled (contain all dependencies in itself, just like the bundled webapp)
|
||||||
|
|
||||||
`preCommit` function can be `async`.
|
`preCommit` function can be `async`.
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ Following props will be passed to the function as a single parameter:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface Props {
|
interface Props {
|
||||||
workspace: string; // same as process.env.GITHUB_WORKSPACE
|
|
||||||
tag: string; // Next tag e.g. v1.12.3
|
tag: string; // Next tag e.g. v1.12.3
|
||||||
version: string; // Next version e.g. 1.12.3
|
version: string; // Next version e.g. 1.12.3
|
||||||
}
|
}
|
||||||
|
@ -49,6 +47,8 @@ interface Props {
|
||||||
export function preCommit(props: Props): void {}
|
export function preCommit(props: Props): void {}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A bunch of useful environment variables are available to the script with `process.env`. See [docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables) to learn more.
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
- `changelog`: The generated changelog for the new version.
|
- `changelog`: The generated changelog for the new version.
|
||||||
|
@ -126,7 +126,7 @@ Use a pre-commit hook
|
||||||
uses: TriPSs/conventional-changelog-action@v3
|
uses: TriPSs/conventional-changelog-action@v3
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.github_token }}
|
github-token: ${{ secrets.github_token }}
|
||||||
pre-commit: ${{ github.workspace }}/some/path/pre-commit.js # requires absolute path
|
pre-commit: some/path/pre-commit.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Github releases
|
Github releases
|
||||||
|
|
Loading…
Reference in New Issue