-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provide error messages as
outputs.error_message
(#194)
- Loading branch information
1 parent
4682b17
commit 880a3c0
Showing
3 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
.github/workflows/lint-pr-title-preview-outputErrorMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: "Lint PR title preview (current branch, outputErrorMessage)" | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- run: yarn install | ||
- run: yarn build | ||
- uses: ./ | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: marocchino/sticky-pull-request-comment@v2 | ||
# When the previous steps fails, the workflow would stop. By adding this | ||
# condition you can continue the execution with the populated error message. | ||
if: always() | ||
with: | ||
header: pr-title-lint-error | ||
message: | | ||
Hey there and thank you for opening this pull request! 👋🏼 | ||
|
||
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. | ||
|
||
Details: | ||
|
||
``` | ||
${{ steps.lint_pr_title.outputs.error_message }} | ||
``` | ||
# Delete a previous comment when the issue has been resolved | ||
- if: ${{ steps.lint_pr_title.outputs.error_message == null }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: pr-title-lint-error | ||
delete: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters