Skip to content

Commit

Permalink
fix: Improve reporting for failed checks (#30)
Browse files Browse the repository at this point in the history
* fix: Validate PR title before setting the status.

* Don't show success message when PR title validation fails.

* Use branch.

* Log validation error.

* More logging.

* Try different event.

* Shorter error message.

* Add github release.

* Remove logging.

* Fix wording.
  • Loading branch information
amannn committed Sep 17, 2020
1 parent fc71bda commit 1aa9e17
Show file tree
Hide file tree
Showing 8,452 changed files with 1,840,732 additions and 12,188 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This enables ESLint to use dependencies of this config
// (see https://github.com/eslint/eslint/issues/3458)
require('eslint-config-molindo/setupPlugins');

module.exports = {
extends: 'molindo/javascript',
env: {
node: true,
jest: true
}
};
6 changes: 6 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
}],
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {"changelogTitle": "# Changelog"}],
["@semantic-release/github", {
"successComment": false,
"failComment": false,
"failTitle": false,
"releasedLabels": false
}],
["@semantic-release/git", {"message": "Release ${nextRelease.version}"}]
]
}
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ This is a [Github Action](https://github.com/features/actions) that ensures that

This is helpful when you're using [semantic-release](https://github.com/semantic-release/semantic-release) with the Conventional Commits preset. When using the "Squash and merge" strategy, Github will suggest to use the PR title as the commit message. With this action you can validate that the PR title will lead to a correct commit message.

## Example
## Validation

Examples for valid PR titles:
- fix: Correct typo.
- feat: Add support for Node 12.
- refactor!: Drop support for Node 6.

Note that since PR titles only have a single line, you have to use the `!` syntax for breaking changes.

See [Conventional Commits](https://www.conventionalcommits.org/) for more examples.

### Work in progress

Github has support for [draft pull requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/), which will disable the merge button until the PR is marked as ready for merge.

However, [this feature might be disabled for your repository](https://github.community/t/draft-pull-requests-not-available/1753/7). In this case you can use the special `[WIP] ` prefix to indicate that a pull request is work in progress and isn't ready to be merged. This will avoid the validation of the PR title and the pull request checks remain pending.

## Example config

```yml
name: "Lint PR"
Expand All @@ -24,15 +41,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Examples for valid PR titles:
- fix: Correct typo.
- feat: Add support for Node 12.
- refactor!: Drop support for Node 6.

Note that since PR titles only have a single line, you have to use the `!` syntax for breaking changes.

See [Conventional Commits](https://www.conventionalcommits.org/) for more examples.

Additionally, the special `[WIP] ` prefix is supported, to indicate that a pull request is work in progress and isn't ready to be merged. In this case the PR title isn't validated and the pull request checks remain pending.

Note the usage of [`pull_request_target`](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) in place of `pull_request` as the event trigger is necessary for a fork-based workflow so the API token is valid for status reporting.
Note the usage of [`pull_request_target`](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) as the event trigger is necessary for a fork-based workflow so the API token is valid for status reporting.
1 change: 1 addition & 0 deletions node_modules/.bin/eslint

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/gonzales

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/js-yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/.bin/json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/prettier

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/regexp-tree

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/.bin/rimraf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

205 changes: 196 additions & 9 deletions node_modules/.yarn-integrity

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/@babel/core/node_modules/.bin/json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1aa9e17

Please sign in to comment.