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

pr-title-conventional-commits: introduce a dedicated action #82

Closed
tbouffard opened this issue Nov 4, 2022 · 0 comments · Fixed by #92
Closed

pr-title-conventional-commits: introduce a dedicated action #82

tbouffard opened this issue Nov 4, 2022 · 0 comments · Fixed by #92
Assignees
Labels
enhancement New feature or request

Comments

@tbouffard
Copy link
Member

tbouffard commented Nov 4, 2022

Today, we mainly use "squash and merge" for Pull Request and we often use the PR title as base of the merge commit (this can be suggested by GH by repository configuration).
We want to have commits that conform to Conventional Commits, so checking the PR title will help.

We want to use an GH Action to check the PR title automatically at first in Bonita Documentation repositories and probably in a lot of other Bonitasoft repositories.
bonitasoft/bonita-documentation-site#422 investigations show that we are already using various actions, but

  • they are not fully compliant as they rely on non accurate regexp
  • several actions are used

We would like to have a shared action for consistency between repositories. We have experimented one in the bonita-doc repository (bonitasoft/bonita-documentation-site#422 (comment)) and we would like to use it as base of the new action. Pros:

  • use real "Conventional Commits" checks (by relying on a JS lib)
  • when the PR title mismatches, it can create a PR comment with an error message and guidance to fix the problem. When everything is back to normal, the PR comment is removed

We want to extend it because

  • when the PR is created from a forked, the PR comment cannot be created (the GH_TOKEN has not enough permissions and a PAT stored in GH Secrets won't be accessible in this case). Managing this case in all workflow file would lead to logic duplication
  • the action requires to pass a GitHub token whereas we always want to pass GH_TOKEN
  • the action doesn't explicit it requires "Pull Request" permissions (to be able to comment)

Proposal

  • Create a composite action based on https://github.com/jef/conventional-commits-pr-action
  • Manage PR created from fork repository: set comments to false in this case
  • README: explain how to use the action including the permissions required for the GH_TOKEN. Also mention the underlying GH action that is used
  • If possible, always use the GH_TOKEN without having to configure it. It is not possible to access to secrets in a composite action: Unable to use GitHub Secret with Composite action actions/runner#1557. But the GH_TOKEN can be used as default of the gh-token input of the action
  • when the original action generates an error, log the PR title to better track what the title was at the time the workflow run occurs. The PR title could also always be logged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant