Title: GitHub · Where software is built
Open Graph Title: python-semantic-release/python-semantic-release
X Title: python-semantic-release/python-semantic-release
Description: Automating Releases via SemVer and Commit Message Conventions - python-semantic-release/python-semantic-release
Open Graph Description: Automating Releases via SemVer and Commit Message Conventions - python-semantic-release/python-semantic-release
X Description: Automating Releases via SemVer and Commit Message Conventions - python-semantic-release/python-semantic-release
Opengraph URL: https://github.com/python-semantic-release/python-semantic-release
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Getting \"Template directory must be inside of the repository directory.\" error when not specifying template_dir option.","articleBody":"## Bug Report\r\n\r\n### Description\r\nRunning \"semantic-release --noop version --print\" to try and verify my configuration and see the next version number.\r\n\r\nI have no `template_dir` in my pyproject.toml, so using the default template.\r\n\r\n\r\n\r\n### Expected behavior\r\nWould not expect this error message since I'm using the default templates and don't have a template directory specified.\r\n\r\n\r\n\r\n### Actual behavior\r\nThe following error:\r\n\r\n```\r\n🛡 You are running in no-operation mode, because the '--noop' flag was supplied\r\n[18:51:22] WARNING [semantic_release.cli.config] WARNING config.from_raw_config: Token value is missing! config.py:558\r\nTemplate directory must be inside of the repository directory.\r\n```\r\n\r\n\r\n### Environment\r\n\r\nWindows 11\r\nPython 3.9\r\nSemantic-Release 9.8.6\r\nPoetry 1.8.2\r\n\r\n\r\n### Configuration\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eSemantic Release Configuration\u003c/summary\u003e\r\n\r\n```toml\r\n...\r\n[tool.semantic_release]\r\nversion_variables = [\r\n \"src/project/__init__.py:__version__\"\r\n]\r\nversion_toml = [\"pyproject.toml:tool.poetry.version\"]\r\nchangelog_file = \"CHANGELOG.md\"\r\nbuild_command = \"poetry build\"\r\ndist_path = \"dist/\"\r\nupload_to_vcs_release = false\r\nupload_to_pypi = false\r\nremove_dist = false\r\npatch_without_tag = true\r\nmajor_on_zero = true\r\n\r\n[tool.semantic_release.commit_parser_options]\r\nallowed_tags = [\"build\", \"chore\", \"ci\", \"docs\", \"feat\", \"fix\", \"perf\", \"style\", \"refactor\", \"test\"]\r\nminor_tags = [\"feat\"]\r\npatch_tags = [\"fix\", \"perf\"]\r\n\r\n[tool.semantic_release.branches.main]\r\nmatch = \"develop\"\r\nprerelease = false\r\n\r\n[tool.semantic_release.branches.others]\r\nmatch = \"^(?!develop$)\"\r\nprerelease = true\r\nprerelease_token = \"alpha\"\r\n```\r\n\r\n\u003c/details\u003e\r\n\u003cbr\u003e\r\n\r\n\r\n### Execution Log\r\n\r\n\u003c!--\r\nPlease rerun the command using with the `-vv` option and include the log here\r\n\r\nIf you are using GitHub Actions, include the log output from the job with the -vv flag\r\nas a root_options argument.\r\n--\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003ccode\u003esemantic-release -vv \u003ci\u003ecommand\u003c/i\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n```log\r\n[18:52:55] DEBUG [semantic_release.cli.commands.main] DEBUG main.main: logging level set to: DEBUG main.py:123\r\n🛡 You are running in no-operation mode, because the '--noop' flag was supplied\r\n DEBUG [semantic_release.cli.commands.main] DEBUG main.main: global cli options: GlobalCommandLineOptions(noop=True, verbosity=2, main.py:135\r\n config_file='pyproject.toml', strict=False)\r\n INFO [semantic_release.cli.util] INFO util.load_raw_config_file: Loading configuration from pyproject.toml util.py:79\r\n DEBUG [semantic_release.cli.util] DEBUG util.load_raw_config_file: Trying to parse configuration pyproject.toml in TOML format util.py:82\r\n DEBUG [semantic_release.cli.config] DEBUG config.select_branch_options: Rejecting group 'main' as 'develop' doesn't match 'fix/deploy2' config.py:421\r\n INFO [semantic_release.cli.config] INFO config.select_branch_options: Using group 'others' options, as '^(?!develop$)' matches 'fix/deploy2' config.py:414\r\n DEBUG [semantic_release.cli.config] DEBUG config.from_raw_config: hvcs token is not set config.py:555\r\n WARNING [semantic_release.cli.config] WARNING config.from_raw_config: Token value is missing! config.py:558\r\nTemplate directory must be inside of the repository directory.\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n### Additional context\r\n\r\nThe following [check in cli/config.py:582](https://github.com/python-semantic-release/python-semantic-release/blob/4e59b501374fe6c6f822cc0e9eb41da3e896f642/semantic_release/cli/config.py#L582) triggers the error:\r\n\r\n```python\r\nif raw.repo_dir not in template_dir.parents:\r\n```\r\n\r\nI added some debug outputs and observe that raw.repo_dir is giving a full path, e.g. \"C:\\Code\\project\" whereas the default template_dir is \"templates\"- not an absolute path. template_dir.parents then comes out to `['.']`. I believe the lack of resolving the path to an absolute path might be to blame here. repo_dir gets resolved to an absolute path by the field_validator in RawConfig, [here](https://github.com/python-semantic-release/python-semantic-release/blob/4e59b501374fe6c6f822cc0e9eb41da3e896f642/semantic_release/cli/config.py#L255).","author":{"url":"https://github.com/Wiley-Black","@type":"Person","name":"Wiley-Black"},"datePublished":"2024-07-25T22:56:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/994/python-semantic-release/issues/994"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:26a472fc-c6de-85ab-0896-60efdbc3f934 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94C8:DDB35:1127690:15B7294:69916EDC |
| html-safe-nonce | 63a649e1a90126fd62f16de557168bbbf45adfdcc7cdf38de3f73c7f36b7f399 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEM4OkREQjM1OjExMjc2OTA6MTVCNzI5NDo2OTkxNkVEQyIsInZpc2l0b3JfaWQiOiI3NTYxNDc2NDk5NzU4NDc3MDIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a7197add6e2ce2e5af7c12f903a87517547085290e37ff03c7f0a6784b6e7a9e |
| hovercard-subject-tag | repository:39765732 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-semantic-release/python-semantic-release/issues/994 |
| twitter:image | https://opengraph.githubassets.com/0b34ceed225779accbaa7938ce0e09811a86e814d868dbb77c206458b152aafd/python-semantic-release/python-semantic-release |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b34ceed225779accbaa7938ce0e09811a86e814d868dbb77c206458b152aafd/python-semantic-release/python-semantic-release |
| og:image:alt | Automating Releases via SemVer and Commit Message Conventions - python-semantic-release/python-semantic-release |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-cache |
| go-import | github.com/python-semantic-release/python-semantic-release git https://github.com/python-semantic-release/python-semantic-release.git |
| octolytics-dimension-user_id | 116517554 |
| octolytics-dimension-user_login | python-semantic-release |
| octolytics-dimension-repository_id | 39765732 |
| octolytics-dimension-repository_nwo | python-semantic-release/python-semantic-release |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 39765732 |
| octolytics-dimension-repository_network_root_nwo | python-semantic-release/python-semantic-release |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width