ci: enforce PR title follows conventional commit (#14)
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
name: 'Lint PR'
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
name: Validate PR title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
id: lint_pr_title
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
requireScope: false
|
||||||
|
|
||||||
|
- 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() && (steps.lint_pr_title.outputs.error_message != null)
|
||||||
|
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://gist.github.com/Zekfad/f51cb06ac76e2457f11c80ed705c95a3#file-conventional-commits-md) 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
|
||||||
+5
-1
@@ -124,7 +124,11 @@ And now you can run goose with this new profile to use the new toolkit!
|
|||||||
goose session start --profile demo
|
goose session start --profile demo
|
||||||
```
|
```
|
||||||
|
|
||||||
[developer]: src/goose/toolkit/developer.py
|
## Conventional Commits
|
||||||
|
|
||||||
|
This project follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for PR titles. Conventional Commits make it easier to understand the history of a project and facilitate automation around versioning and changelog generation.
|
||||||
|
|
||||||
|
[developer]: src/goose/toolkit/developer.py
|
||||||
[uv]: https://docs.astral.sh/uv/
|
[uv]: https://docs.astral.sh/uv/
|
||||||
[ruff]: https://docs.astral.sh/ruff/
|
[ruff]: https://docs.astral.sh/ruff/
|
||||||
[just]: https://github.com/casey/just
|
[just]: https://github.com/casey/just
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Developer(Toolkit):
|
|||||||
|
|
||||||
def system(self) -> str:
|
def system(self) -> str:
|
||||||
"""Retrieve system configuration details for developer"""
|
"""Retrieve system configuration details for developer"""
|
||||||
hints_path = Path('.goosehints')
|
hints_path = Path(".goosehints")
|
||||||
system_prompt = Message.load("prompts/developer.jinja").text
|
system_prompt = Message.load("prompts/developer.jinja").text
|
||||||
if hints_path.is_file():
|
if hints_path.is_file():
|
||||||
goosehints = hints_path.read_text()
|
goosehints = hints_path.read_text()
|
||||||
|
|||||||
@@ -68,5 +68,3 @@ def test_write_file(temp_dir, developer_toolkit):
|
|||||||
content = "Hello World"
|
content = "Hello World"
|
||||||
developer_toolkit.write_file(test_file.as_posix(), content)
|
developer_toolkit.write_file(test_file.as_posix(), content)
|
||||||
assert test_file.read_text() == content
|
assert test_file.read_text() == content
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user