Skip to content

Commit

Permalink
feature: register handler factory (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: abdulrahman <[email protected]>
Co-authored-by: mehdihadeli <[email protected]>
  • Loading branch information
3 people authored Apr 2, 2023
1 parent 5dec060 commit fa71625
Show file tree
Hide file tree
Showing 16 changed files with 537 additions and 96 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5
assignees:
- mehdihadeli
87 changes: 87 additions & 0 deletions .github/multi-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# https://github.com/fuxingloh/multi-labeler
# https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax
version: v1

labels:
- label: "feature"
matcher:
title: '^(feat)(\([a-z ]+\))?: .'
commits: '^(feat)(\([a-z ]+\))?: .'
branch: '(feat)(\([a-z ]+\))?\/.'

- label: "bug"
matcher:
title: '^(fix)(\([a-z ]+\))?: .'
commits: '^(fix)(\([a-z ]+\))?: .'
branch: '(fix)(\([a-z ]+\))?\/.'

- label: "chore"
matcher:
title: '^(chore)(\([a-z ]+\))?: .'
commits: '^(chore)(\([a-z ]+\))?: .'
branch: '(chore)(\([a-z ]+\))?\/.'

- label: "documentation"
matcher:
title: '^(docs)(\([a-z ]+\))?: .'
commits: '^(docs)(\([a-z ]+\))?: .'
branch: '(docs)(\([a-z ]+\))?\/.'

- label: "devops"
matcher:
title: '^(ci)(\([a-z ]+\))?: .'
commits: '^(ci)(\([a-z ]+\))?: .'
branch: '(ci)(\([a-z ]+\))?\/.'

- label: "ci/cd"
matcher:
title: '^(ci)(\([a-z ]+\))?: .'
commits: '^(ci)(\([a-z ]+\))?: .'
branch: '(ci)(\([a-z ]+\))?\/.'

- label: "enhancement"
matcher:
title: '^(refactor)(\([a-z ]+\))?: .'
commits: '^(refactor)(\([a-z ]+\))?: .'
branch: '(refactor)(\([a-z ]+\))?\/.'

- label: "formatting"
matcher:
title: '^(style)(\([a-z ]+\))?: .'
commits: '^(style)(\([a-z ]+\))?: .'
branch: '(style)(\([a-z ]+\))?\/.'

- label: "performance"
matcher:
title: '^(perf)(\([a-z ]+\))?: .'
commits: '^(perf)(\([a-z ]+\))?: .'
branch: '(perf)(\([a-z ]+\))?\/.'

- label: "build"
matcher:
title: '^(build)(\([a-z ]+\))?: .'
commits: '^(build)(\([a-z ]+\))?: .'
branch: '(build)(\([a-z ]+\))?\/.'

- label: "test"
matcher:
title: '^(test)(\([a-z ]+\))?: .'
commits: '^(test)(\([a-z ]+\))?: .'
branch: '(test)(\([a-z ]+\))?\/.'

- label: "dependencies"
matcher:
title: '^build\(deps\): .'
commits: '^build\(deps\): .'

- label: "minor"
matcher:
title: '^(feat)(\([a-z ]+\))?: .'
commits: '^(feat)(\([a-z ]+\))?: .'
branch: '(feat)(\([a-z ]+\))?\/.'

- label: "patch"
matcher:
title: '^(fix)(\([a-z ]+\))?: .'
commits: '^(fix)(\([a-z ]+\))?: .'
branch: '(fix)(\([a-z ]+\))?\/.'
5 changes: 0 additions & 5 deletions .github/pr-labeler.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!-- Type of change
Please label this PR with one of the existing labels, depending on the scope of your change.
-->

## What does this PR do?

<!-- Mandatory
Explain here the changes you made on the PR. Please explain the WHAT: patterns used, algorithms implemented, design architecture, etc.
-->

## Why is it important?

<!-- Mandatory
Explain here the WHY, or the rationale / motivation for the changes.
-->

## Related issues

<!-- Recommended
Link related issues below. Insert the issue link or reference after the word "Closes" if merging this should automatically close it.
- Closes #123
- Relates #123
- Requires #123
- Supersedes #123
-->
-

<!-- Recommended
## How to test this PR
Explain here how this PR will be tested by the reviewer: commands, dependencies, steps, etc.
-->

<!-- Optional
## Follow-ups
Add here any thought that you consider could be identified as an actionable step once this PR is merged.
-->
67 changes: 59 additions & 8 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,34 @@
# This release drafter follows the conventions
# from https://keepachangelog.com

# https://github.com/release-drafter/release-drafter/issues/551
# https://github.com/release-drafter/release-drafter/pull/1013
# https://github.com/release-drafter/release-drafter/issues/139
# https://github.com/atk4/data/blob/develop/.github/release-drafter.yml
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- title: ♻️ Enhancement
labels:
- enhancement
- refactor
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ⚠️ Changes
- title: 👷 CI
labels:
- ci
- title: ⚠️ Breaking Changes
labels:
- changed
- breaking-changes
- title: ⛔️ Deprecated
labels:
- deprecated
Expand All @@ -35,7 +44,7 @@ categories:
- title: 📄 Documentation
labels:
- docs
- documentation
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
Expand All @@ -44,21 +53,63 @@ categories:
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
collapse-after: 10
- title: 🚩 Other changes
## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934


# https://www.trywilco.com/post/wilco-ci-cd-github-heroku
# https://github.com/release-drafter/release-drafter#autolabeler
# https://github.com/fuxingloh/multi-labeler

# Using regex for defining rules - https://regexr.com/
# https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax
autolabeler:
- label: 'chore'
branch:
- '(chore)(\([a-z ]+\))?\/.'
title:
- '^(chore)(\([a-z ]+\))?: .'
- label: 'bug'
branch:
- '(fix)(\([a-z ]+\))?\/.'
title:
- '^(fix)(\([a-z ]+\))?: .'
- label: 'feature'
branch:
- '(feat)(\([a-z ]+\))?\/.'
title:
- '^(feat)(\([a-z ]+\))?: .'
- label: 'ci/cd'
branch:
- '(ci)(\([a-z ]+\))?\/.'
title:
- '^(ci)(\([a-z ]+\))?: .'
- label: 'minor'
branch:
- '(feat)(\([a-z ]+\))?\/.'
title:
- '^(feat)(\([a-z ]+\))?: .'
- label: 'patch'
branch:
- '(fix)(\([a-z ]+\))?\/.'
- '(ci)(\([a-z ]+\))?\/.'
title:
- '^(fix)(\([a-z ]+\))?: .'
- '^(ci)(\([a-z ]+\))?: .'

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
- breaking-changes
minor:
labels:
- minor
patch:
labels:
- patch
default: patch

exclude-labels:
- skip-changelog
- skip-changelog
38 changes: 31 additions & 7 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
# https://github.com/bcoe/conventional-release-labels
# https://dev.to/github/how-to-automatically-generate-release-notes-for-your-project-2ng8
# https://www.conventionalcommits.org/en/v1.0.0/

# github release pre-defined template
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Features
- title: 🚀 Features
labels:
- feature
- title: Fixes
- title: 🐛 Bug Fixes
labels:
- bug
- fix
- enhancement
- title: Enhancement
- bug
- title: ♻️ Changes
labels:
- refactor
- changed
- enhancement
- refactor
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
- title: 🧰 Maintenance
label: 'chore'
- title: 🧺 Miscellaneous #Everything except ABAP
label: misc
- title: Other Changes
labels:
- "*"
- "*"
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ "main" ]
branches: [ "main, dev" ]
pull_request:
branches: [ "main" ]
branches: [ "main, dev" ]

jobs:

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# https://github.com/amannn/action-semantic-pull-request
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests
# Linting workflow: https://github.com/rhysd/actionlint

name: Conventional Commits

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- edited
- ready_for_review

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
conventional-commits:
runs-on: ubuntu-latest
steps:
- name: Check Pull Request Title Conventional Commits
uses: amannn/action-semantic-pull-request@v5
if: always()
id: check-pull-request-title-conventional-commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Comments the error message from the above lint_pr_title action
- if: ${{ always() && steps.check-pull-request-title-conventional-commits.outputs.error_message != null}}
name: Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
We require all PRs to follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
More details 👇🏼
```
${{ steps.check-pull-request-title-conventional-commits.outputs.error_message}}
```
# deletes the error comment if the title is correct
- if: ${{ steps.check-pull-request-title-conventional-commits.outputs.error_message == null }}
name: delete the comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit fa71625

Please sign in to comment.