feat(github,dotfiles): add CI to check PR title scope against changed files#148
feat(github,dotfiles): add CI to check PR title scope against changed files#148shiron-dev merged 5 commits intomainfrom
Conversation
This CI ensures that the scope(s) in a PR title accurately reflect the directories of the changed files. It introduces: - A GitHub Actions workflow (`.github/workflows/check_pr_scope.yml`) to perform the check. - A configuration file (`scope-rules.json`) to define the mapping between file patterns and scopes. - A `README.md` explaining the CI's purpose and usage.
|
undefined |
Updates the PR scope check CI to post a comment on the pull request when the scope validation fails. The comment details: - If the PR title format is incorrect (missing scope). - Which scopes are missing from the PR title based on changed files. This provides immediate feedback to the PR author, making it easier to correct the PR title. Also ensures README.md is correctly created and updated with this new behavior.
61a4dce to
91f321f
Compare
…ling This commit addresses the issue where 'undefined' could appear in PR comments posted by the scope check CI. Fixes include: - Robust handling of empty PR titles, with specific error messages. - Sanitization of PR titles to remove potential newline characters from jq output. - Improved logic for constructing suggestion messages in comments, ensuring variables are correctly handled even if empty. - Safe multi-line string assignment to GITHUB_ENV for the comment body using heredocs, preventing issues with special characters and newlines. These changes ensure more reliable and informative feedback in PR comments when scope validation fails.
91f321f to
166d70a
Compare
|
undefined |
1 similar comment
|
undefined |
|
undefined |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
2 similar comments
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
|
PRのスコープが正しくありません。 |
This commit updates the `.github/workflows/check_pr_scope.yml` file to: - Upgrade the `actions/checkout` from v3 to v4 for improved functionality. - Upgrade the `actions/github-script` from v6 to v7 for better performance. - Enhance the handling of environment variables and multi-line string assignments for output consistency. These changes aim to streamline the workflow and ensure compatibility with the latest GitHub Actions features. refactor: improve PR scope check script for clarity and efficiency This commit refactors the `check_pr_scope.sh` script to enhance readability and performance. Key changes include: - Replaced the use of array assignment with `mapfile` for trimming whitespace from scopes. - Simplified the reading of `scope-rules.json` using a direct `jq` command. - Cleaned up conditional checks for scope matching to improve clarity. These modifications aim to streamline the script's functionality and maintainability. fix: enhance PR comment body handling in scope check workflow This commit improves the GitHub Actions workflow for PR scope checks by: - Adding a step to set the comment body with detailed information about scope validation failures. - Updating the comment creation step to utilize the newly set comment body, ensuring accurate and informative feedback for PR authors. These changes aim to provide clearer communication regarding scope issues in pull requests. fix: update PR comment body for clarity in scope validation This commit modifies the comment body in the PR scope check workflow to provide clearer information regarding scope validation failures. The changes include: - Updating the wording to specify the current and detected scopes more explicitly. These adjustments aim to enhance communication with PR authors about scope issues. fix: enhance output handling in PR scope check workflow This commit updates the `.github/workflows/check_pr_scope.yml` file to improve the output handling of the PR scope check job. Key changes include: - Adding outputs for the PR title and changed files, allowing for more informative feedback in the workflow. These enhancements aim to provide clearer context and details for PR authors regarding scope validation. fix: improve multi-line string handling in PR scope check workflow This commit updates the `.github/workflows/check_pr_scope.yml` file to enhance the handling of the comment body for PR scope validation failures. Key changes include: - Utilizing a heredoc format for setting the comment body, allowing for clearer multi-line output. - Ensuring that the message structure is more readable and maintains the intended formatting. These improvements aim to provide better feedback to PR authors regarding scope issues. fix: add required scopes output to PR scope check workflow This commit enhances the GitHub Actions workflow for PR scope checks by: - Adding the `required_scopes` output to the workflow, providing more detailed information about the scopes needed based on changed files. - Updating the comment body to reflect the correct required scopes in case of validation failures. These changes aim to improve feedback for PR authors regarding scope validation issues. fix: add debug steps to PR scope check workflow This commit enhances the GitHub Actions workflow for PR scope checks by: - Adding debug steps to output the PR title and changed files before the scope check. - Providing clearer visibility into the workflow's execution, aiding in troubleshooting and validation of inputs. These changes aim to improve the debugging process for PR authors and maintainers. fix: add debug output for PR title retrieval in scope check workflow This commit enhances the GitHub Actions workflow by adding debug output steps to the PR title retrieval process. Key changes include: - Printing the contents of `GITHUB_EVENT_PATH` and the output of the `jq` command to provide better visibility into the data being processed. - This improvement aims to facilitate troubleshooting and ensure the correct PR title is being captured for scope validation. fix: streamline PR title retrieval in scope check workflow This commit simplifies the PR title retrieval process in the GitHub Actions workflow by: - Removing unnecessary debug output for `GITHUB_EVENT_PATH` and `jq` command results. - Directly capturing and echoing the PR title, enhancing clarity and reducing clutter in the workflow logs. These changes aim to improve the efficiency of the workflow while maintaining essential output for debugging. fix: update PR scope output handling in workflow and script This commit enhances the GitHub Actions workflow and the associated script for PR scope checks by: - Modifying the workflow to output `pr_scopes` instead of the PR title, providing more relevant information for scope validation. - Adding the `pr_scopes` output to the `GITHUB_OUTPUT` in the script, ensuring it is available for subsequent steps. These changes aim to improve the clarity and accuracy of the feedback provided to PR authors regarding scope validation issues.
aae6eb6 to
8a01b2e
Compare
This commit deletes the `README.md` file that provided an overview of the PR scope check CI, including its purpose, functionality, configuration, and troubleshooting steps. The removal is part of a cleanup effort to streamline documentation and may indicate a shift in how information is presented or maintained in the repository.
This CI ensures that the scope(s) in a PR title accurately reflect the directories of the changed files.
It introduces:
.github/workflows/check_pr_scope.yml) to perform the check.scope-rules.json) to define the mapping between file patterns and scopes.README.mdexplaining the CI's purpose and usage.