Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add common ci #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: add common ci #1

wants to merge 3 commits into from

Conversation

JaeAeich
Copy link
Collaborator

@JaeAeich JaeAeich commented Aug 31, 2024

Summary by Sourcery

Add a common CI configuration for PR evaluations, including workflows for detecting unresolved conflicts, running pre-commit checks, and validating semantic PR titles. Include documentation for each action to guide users on their usage and configuration.

CI:

  • Introduce a new CI workflow for PR evaluations, including checks for unresolved conflicts, pre-commit checks, and semantic PR title validation.

Documentation:

  • Add documentation for the Semantic PR Check, Pre-Commit Evaluations, and Detect Unresolved Conflicts actions, detailing their purpose, prerequisites, and inputs.

Copy link

sourcery-ai bot commented Aug 31, 2024

Reviewer's Guide by Sourcery

This pull request introduces a common CI configuration for pull request evaluations. It adds several GitHub Actions workflows and their corresponding action files to perform various checks on pull requests, including detecting unresolved conflicts, running pre-commit checks, and validating semantic PR titles.

File-Level Changes

Change Details Files
Added a GitHub Actions workflow for PR evaluations
  • Configured workflow to run on push to main and various pull request events
  • Added job to detect unresolved conflicts
  • Added job for pre-commit checks
  • Added job for semantic PR title check
actions/common/pr-evaluations/example.yaml
Implemented semantic PR title check action
  • Created composite action for checking PR title semantics
  • Configured allowed types for semantic PR titles
  • Added check for PR title length (max 50 characters)
  • Included error message for non-compliant PR titles
actions/common/pr-evaluations/semantic-pr-title/action.yaml
actions/common/pr-evaluations/semantic-pr-title/README.md
Added pre-commit check action
  • Created composite action for running pre-commit checks
  • Added step to install pre-commit
  • Configured action to run all pre-commit checks defined in .pre-commit-config.yaml
actions/common/pr-evaluations/pre-commit/action.yaml
actions/common/pr-evaluations/pre-commit/README.md
Implemented unresolved conflicts detection action
  • Created composite action for detecting unresolved merge conflicts
  • Added step to check for merge conflict markers in the repository
  • Configured action to exit with an error if conflict markers are found
actions/common/pr-evaluations/unresolved-conflicts/action.yaml
actions/common/pr-evaluations/unresolved-conflicts/README.md

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@JaeAeich JaeAeich requested a review from uniqueg August 31, 2024 19:52
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @JaeAeich - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 5 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

- main

jobs:
detect-unresolved-conflicts:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider reordering jobs to match execution order

The detect-unresolved-conflicts job depends on semantic-pr-check, but semantic-pr-check is defined later in the file. Consider reordering the jobs to match their execution order for better readability and to avoid potential issues.

  semantic-pr-check:
    runs-on: ubuntu-latest

  detect-unresolved-conflicts:
    runs-on: ubuntu-latest
    needs: semantic-pr-check

Comment on lines +4 to +14
readability.

## Table of Contents

- [Prerequisites](#prerequisites)
- [Inputs](#inputs)

## Prerequisites

Ensure that the pull request titles follow semantic guidelines before using this
action. This includes starting the PR title with one of the allowed types (e.g.,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Consider adding an example of a well-formatted PR title

This would help users understand exactly what is expected in terms of PR title formatting.

readability.

## Table of Contents

- [Prerequisites](#prerequisites)
- [Inputs](#inputs)

## Prerequisites

Ensure that the pull request titles follow semantic guidelines before using this
action. This includes starting the PR title with one of the allowed types (e.g.,
`fix`, `feat`, `docs`) and ensuring that the title does not exceed 50 characters.

Example of a well-formatted PR title:
`feat: Add user authentication system`

| Name | Description | Required | Default |
|----------------|-----------------------------------------------|----------|---------|
| `github_token` | The GitHub token to use for authentication | Yes | N/A | |
`pr_title` | The title of the pull request | Yes | N/A |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Fix alignment in the Inputs table

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, an opening pipe (|) seems to be missing

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, the missing opening pipe (|) is causing the misalignment in the Inputs table. Adding the pipe at the beginning of the pr_title row will fix the alignment issue. Here's how the corrected table should look:

| Name          | Description                                 | Required | Default |
|---------------|---------------------------------------------|----------|---------|
| `github_token`| The GitHub token to use for authentication  | Yes      | N/A     |
| `pr_title`    | The title of the pull request               | Yes      | N/A     |

Feel free to update the documentation with this correction. Let me know if you need any further assistance!


| Name | Description | Required | Default |
|----------------|-----------------------------------------------|----------|---------|
| `github_token` | The GitHub token to use for authentication | Yes | N/A | |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Add more information about the use of github_token

Explain briefly what operations this token allows the action to perform.

Suggested change
| `github_token` | The GitHub token to use for authentication | Yes | N/A | |
| `github_token` | GitHub token for authentication. Allows the action to create, update, and manage pull requests. | Yes | N/A |


N/A

[pcc]: https://github.com/elixir-cloud-aai/cookiecutter-python/blob/main/%7B%7B%20cookiecutter.project_name_dashed%20%7D%7D/.pre-commit-config.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Consider using a shorter reference name for the link

This would improve readability. For example, you could use '[pre-commit-config]' instead of '[pcc]'.

[pre-commit-config]: https://github.com/elixir-cloud-aai/cookiecutter-python/blob/main/%7B%7B%20cookiecutter.project_name_dashed%20%7D%7D/.pre-commit-config.yaml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why it says a shorter reference name and then suggests a longer one - but I do agree that more explicit names are generally better for readability and reusability.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, the suggestion does seem a bit contradictory in terms of length. The key point here is about clarity and explicitness rather than just shortening the reference name. Using a more descriptive name like [pre-commit-config] can make the documentation clearer and more intuitive, especially for those who might not be familiar with the abbreviation [pcc]. It's about finding a balance between brevity and clarity, and in this case, a slightly longer but more descriptive name can enhance readability and understanding. Let me know if you have any other questions or need further clarification!

Comment on lines +14 to +15
Configure pre-commit hooks in root directory of the repository in
`.pre-commit-config.yaml` file. For example, look into [pre-commit config][pcc]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): Add a brief explanation of pre-commit hooks

This would be helpful for users who might not be familiar with the concept.

Suggested change
Configure pre-commit hooks in root directory of the repository in
`.pre-commit-config.yaml` file. For example, look into [pre-commit config][pcc]
Configure pre-commit hooks in the root directory of the repository using a
`.pre-commit-config.yaml` file. Pre-commit hooks are automated checks that run
before each commit, ensuring code quality and consistency. For an example
configuration, refer to the [pre-commit config][pcc] in the cookiecutter-python
repository.

Copy link
Member

@uniqueg uniqueg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good - don't really have anything to add outside of the Sourcery suggestions


N/A

[pcc]: https://github.com/elixir-cloud-aai/cookiecutter-python/blob/main/%7B%7B%20cookiecutter.project_name_dashed%20%7D%7D/.pre-commit-config.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why it says a shorter reference name and then suggests a longer one - but I do agree that more explicit names are generally better for readability and reusability.

| Name | Description | Required | Default |
|----------------|-----------------------------------------------|----------|---------|
| `github_token` | The GitHub token to use for authentication | Yes | N/A | |
`pr_title` | The title of the pull request | Yes | N/A |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, an opening pipe (|) seems to be missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants