-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Implement check-pr-title workflow #73
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b74950a
feat: Implement check-pr-title workflow
mathbunnyru 49d3f6b
Do not add label
mathbunnyru 517a0c7
Provide explicit types
mathbunnyru e5dbfd2
Update docs
mathbunnyru c59fa73
Remove running on push and schedule, since PR info is not available t…
mathbunnyru 15afafb
Add default shell
mathbunnyru aa88702
Merge branch 'main' into check_pr_title
mathbunnyru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Check PR title | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| check_title: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: ytanikin/pr-conventional-commits@fda730cb152c05a849d6d84325e50c6182d9d1e9 # 1.5.1 | ||
| with: | ||
| task_types: '["build", "feat", "fix", "docs", "test", "ci", "style", "refactor", "perf", "chore"]' | ||
| add_label: false | ||
|
|
||
| - name: Check if title starts with upper-case letter | ||
| env: | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| if [[ ! "${PR_TITLE}" =~ ^[a-z]+:\ [\[A-Z] ]]; then | ||
| echo "Error: PR title must start with an upper-case letter." | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| on: | ||
| pull_request: | ||
| types: [opened, edited, reopened, synchronize] | ||
bthomee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-check-pr-title: | ||
| uses: ./.github/workflows/check-pr-title.yml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since the rippled repo doesn't support the
featandstyleprefixes, can we allow the caller to set the task types as an input?One option would be to have a comma-separated list as input, and another would be to have a set of boolean inputs that all default to true but which can be easily overridden. You'd have to do some preprocessing before calling the action, but shouldn't be too much effort.
@ximinez: it would make sense for clio and rippled to support the same prefixes.
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.
featis used though: XRPLF/rippled@ed5d6f3I haven't found
style:, but I think the easiest solution would be to just use the same list - it's been working well at Clio, and doesn't create confusion.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.
Don't we already have the PR template to capture this information? So, either we keep using that or remove that?
I think the major use-case of this won't be just to identify PR category from title, but to also filter them in searches. Although, that can be done using string matching in title, but it is fragile. Filtering using labels though is much more robust. So, better way would be to just program the Copilot to analyze changes in PR and assign a label to it automatically. What do you think?
Uh oh!
There was an error while loading. Please reload this page.
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.
I will remove that, that was my plan and part of the frustration. It will be a part of the rippled PR after this one gets merged.
Since we don't know yet how to launch Copilot using corporate tokens, I think it might be a further improvement, not something that can be implemented right now.
Uh oh!
There was an error while loading. Please reload this page.
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.
We should ask developers to follow this workflow then. Also, check this out: #76
Uh oh!
There was an error while loading. Please reload this page.
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.
What do you mean?
It will be automatic workflow that verifies that PR title is as expected, and if everything's good no action won't be needed, if not - they will get red CI (and will eventually fix it).
It looks like a reimplementation of
add_label+custom_labelsof theytanikin/pr-conventional-commits.I didn't want to add labels here, because neither Clio, nor rippled uses automatic labels for our own PRs right now, so I didn't want to deal with this problem.
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.
I meant the workflow of adding the
Type of Changevalue or Label, so that we can use these values while filtering PRs. The PR I created automatically adds label, so dev. doesn't need to do it. This way we don't need to introduce the PR title requirements. Since the labels are more reliable and useful.Besides, how would you tell a developer which prefix to use in the title of their change? Maybe by adding information regarding that in the PR template?
So, developers then need to read those details and then update the PR title accordingly. I would propose to keep the existing
Type of Changesection, let dev. select the correct option there, as they do now. Then the workflow script automatically apply the correct label to the PR. So, basically nothing changes for developers and we get what we want.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.
@pratikmankawde let's discuss your suggestion offline & merge this PR to make things at least better going forward.