From 990e9c9efd4ea6816d1a1fdd061cc264bd87386d Mon Sep 17 00:00:00 2001 From: Luke Alvoeiro Date: Sun, 25 Aug 2024 23:35:31 -0700 Subject: [PATCH 1/5] add conventional commit pr title --- .github/workflows/pull_request_title.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/pull_request_title.yaml diff --git a/.github/workflows/pull_request_title.yaml b/.github/workflows/pull_request_title.yaml new file mode 100644 index 000000000000..bedaa8e42f6d --- /dev/null +++ b/.github/workflows/pull_request_title.yaml @@ -0,0 +1,19 @@ +name: Check PR title + +on: + pull_request_target: + types: + - opened + - reopened + - edited + - synchronize + +jobs: + lint: + runs-on: ubuntu-latest + permissions: + statuses: write + steps: + - uses: aslafy-z/conventional-pr-title-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d953aeb74c3bc4f0956bee78da33cb99bd02858d Mon Sep 17 00:00:00 2001 From: Luke Alvoeiro Date: Mon, 26 Aug 2024 08:52:31 -0700 Subject: [PATCH 2/5] change to use different GH action --- .github/workflows/pull_request_title.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_request_title.yaml b/.github/workflows/pull_request_title.yaml index bedaa8e42f6d..b06f470a7969 100644 --- a/.github/workflows/pull_request_title.yaml +++ b/.github/workflows/pull_request_title.yaml @@ -1,19 +1,21 @@ -name: Check PR title +name: "Lint PR" on: pull_request_target: types: - opened - - reopened - edited - synchronize + - reopened + +permissions: + pull-requests: read jobs: - lint: + main: + name: Validate PR title runs-on: ubuntu-latest - permissions: - statuses: write steps: - - uses: aslafy-z/conventional-pr-title-action@v3 + - uses: amannn/action-semantic-pull-request@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From afda8f7846dec564b890888f7c863c3e03d73baa Mon Sep 17 00:00:00 2001 From: Luke Alvoeiro Date: Wed, 4 Sep 2024 10:32:37 -0700 Subject: [PATCH 3/5] PR comment to indicate cause of failure --- .github/workflows/pull_request_title.yaml | 31 +++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request_title.yaml b/.github/workflows/pull_request_title.yaml index b06f470a7969..8a32172a1bd7 100644 --- a/.github/workflows/pull_request_title.yaml +++ b/.github/workflows/pull_request_title.yaml @@ -1,4 +1,4 @@ -name: "Lint PR" +name: 'Lint PR' on: pull_request_target: @@ -9,7 +9,7 @@ on: - reopened permissions: - pull-requests: read + pull-requests: write jobs: main: @@ -17,5 +17,32 @@ jobs: 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 From 88ae5ec15f7dde30937db91057c2ffe39e98416c Mon Sep 17 00:00:00 2001 From: Luke Alvoeiro Date: Wed, 4 Sep 2024 10:45:22 -0700 Subject: [PATCH 4/5] straggler formats --- src/goose/toolkit/developer.py | 2 +- tests/toolkit/test_developer.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/goose/toolkit/developer.py b/src/goose/toolkit/developer.py index 7a7357496f7c..aa27b3a75b3d 100644 --- a/src/goose/toolkit/developer.py +++ b/src/goose/toolkit/developer.py @@ -34,7 +34,7 @@ class Developer(Toolkit): def system(self) -> str: """Retrieve system configuration details for developer""" - hints_path = Path('.goosehints') + hints_path = Path(".goosehints") system_prompt = Message.load("prompts/developer.jinja").text if hints_path.is_file(): goosehints = hints_path.read_text() diff --git a/tests/toolkit/test_developer.py b/tests/toolkit/test_developer.py index e049ee9f20bb..53c1c844a5b7 100644 --- a/tests/toolkit/test_developer.py +++ b/tests/toolkit/test_developer.py @@ -68,5 +68,3 @@ def test_write_file(temp_dir, developer_toolkit): content = "Hello World" developer_toolkit.write_file(test_file.as_posix(), content) assert test_file.read_text() == content - - From 62e944b4352a7866cbb7282335d9adfad5c3999e Mon Sep 17 00:00:00 2001 From: Luke Alvoeiro Date: Wed, 4 Sep 2024 11:40:27 -0700 Subject: [PATCH 5/5] indicate how to use conventional commits --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a81c642513b2..daf70867c30c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,7 +124,11 @@ And now you can run goose with this new profile to use the new toolkit! 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/ [ruff]: https://docs.astral.sh/ruff/ [just]: https://github.com/casey/just