-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: PR evaluations | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
- edited | ||
branches: | ||
- main | ||
|
||
jobs: | ||
detect-unresolved-conflicts: | ||
runs-on: ubuntu-latest | ||
needs: semantic-pr-check | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Detect unresolved conflicts | ||
uses: elixir-cloud-aai/actions/common/unresolved-conflicts@main | ||
|
||
pre-commit-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Pre-commit check | ||
uses: elixir-cloud-aai/actions/common/pre-commit@main | ||
|
||
semantic-pr-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Semantic PR check | ||
uses: elixir-cloud-aai/actions/common/semantic-pr-title@main | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
pr_title: ${{ github.event.pull_request.title }} | ||
... |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||||||
# Pre-Commit Evaluations | ||||||||||||||||
|
||||||||||||||||
Uses the `pre-commit` tool to run a series of checks on the repository before a | ||||||||||||||||
pull request is created. The checks are defined in the `.pre-commit-config.yaml` | ||||||||||||||||
file in the repository's root directory. | ||||||||||||||||
|
||||||||||||||||
## Table of Contents | ||||||||||||||||
|
||||||||||||||||
- [Prerequisites](#prerequisites) | ||||||||||||||||
- [Inputs](#inputs) | ||||||||||||||||
|
||||||||||||||||
## Prerequisites | ||||||||||||||||
|
||||||||||||||||
Configure pre-commit hooks in root directory of the repository in | ||||||||||||||||
`.pre-commit-config.yaml` file. For example, look into [pre-commit config][pcc] | ||||||||||||||||
Comment on lines
+14
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||||||||||||
of cookiecutter-python repository. | ||||||||||||||||
|
||||||||||||||||
## Inputs | ||||||||||||||||
|
||||||||||||||||
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 | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]'.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: Pre commit checks | ||
description: Runs all pre-commit checks defined in .pre-commit-config.yaml | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install pre-commit | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y pre-commit | ||
|
||
- name: Run pre-commit checks | ||
shell: bash | ||
run: pre-commit run --all-files | ||
... |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||
# Semantic PR Check | ||||||
|
||||||
Checks if the PR title follows semantic guidelines to ensure consistency and | ||||||
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., | ||||||
Comment on lines
+4
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
|
||||||
`fix`, `feat`, `docs`) and ensuring that the title does not exceed 50 | ||||||
characters. | ||||||
|
||||||
## Inputs | ||||||
|
||||||
| Name | Description | Required | Default | | ||||||
|----------------|-----------------------------------------------|----------|---------| | ||||||
| `github_token` | The GitHub token to use for authentication | Yes | N/A | | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||
`pr_title` | The title of the pull request | Yes | N/A | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (documentation): Fix alignment in the Inputs table There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, an opening pipe ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, the missing opening pipe ( | 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! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
name: Semantic PR Check | ||
description: Checks if the PR title follows semantic guidelines. | ||
|
||
inputs: | ||
github_token: | ||
description: The GitHub token to use for authentication | ||
required: true | ||
pr_title: | ||
description: The title of the pull request | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check if the PR title is semantic | ||
uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.github_token }} | ||
with: | ||
types: | | ||
fix | ||
feat | ||
docs | ||
style | ||
refactor | ||
perf | ||
test | ||
build | ||
ci | ||
chore | ||
revert | ||
subjectPattern: ^(?![A-Z])(?=.{1,50}$).+$ | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
doesn't start with an uppercase character & not have more than 50 | ||
characters. | ||
|
||
- name: Check length of PR title | ||
shell: bash | ||
run: | | ||
PR_TITLE="${{ inputs.pr_title }}" | ||
if [ ${#PR_TITLE} -gt 50 ]; then | ||
echo "The PR title is too long. Please keep it under 50 characters." | ||
exit 1 | ||
fi | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Detect Unresolved Conflicts | ||
|
||
Detects unresolved merge conflicts in the repository to prevent merging code | ||
with unresolved conflicts. | ||
|
||
## Table of Contents | ||
|
||
- [Prerequisites](#prerequisites) | ||
- [Inputs](#inputs) | ||
|
||
## Prerequisites | ||
|
||
Ensure that the repository is checked out and the latest changes are fetched | ||
before running this action. This action will scan the repository for unresolved | ||
merge conflict markers (`<<<<<<<`). | ||
|
||
## Inputs | ||
|
||
N/A |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Detect Unresolved Conflicts | ||
description: Detects unresolved merge conflicts in the repository. | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Detect unresolved merge conflicts | ||
shell: bash | ||
run: | | ||
git --no-pager grep "<<<<<<<" ":(exclude).github/" || true | ||
if git grep "<<<<<<<" ":(exclude).github/" | wc --lines; then | ||
echo "Merge conflict markers found!" | ||
exit 1 | ||
fi | ||
... |
There was a problem hiding this comment.
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 onsemantic-pr-check
, butsemantic-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.