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

misc: add initial config #1

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: breaking
color: "b60205"
description: This change is not backwards compatible
- name: bug
color: "d93f0b"
description: Something isn't working
- name: documentation
color: "0075ca"
description: Improvements or additions to documentation
- name: enhancement
color: "0e8a16"
description: New feature or request
- name: feature
color: "0e8a16"
description: New feature or request
- name: fix
color: "d93f0b"
description: Something isn't working
- name: misc
color: "#6B93D3"
description: Miscellaneous task not covered by something else
- name: no-changelog
color: "cccccc"
description: No entry should be added to the release notes and changelog
- name: security
color: "5319e7"
description: Solving a security issue
86 changes: 86 additions & 0 deletions .github/release-drafter-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
version-template: '$MAJOR.$MINOR.$PATCH'
change-title-escapes: '\<*_&'

categories:
- title: '🚀 Features'
labels:
- 'breaking'
- 'enhancement'
- 'feature'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- 'fix'
- 'security'
- title: '📖 Documentation'
labels:
- 'documentation'
- title: '🧺 Miscellaneous'
labels:
- 'misc'

version-resolver:
major:
labels:
- 'breaking'
minor:
labels:
- 'enhancement'
- 'feature'
patch:
labels:
- 'bug'
- 'documentation'
- 'fix'
- 'security'
default: 'minor'

autolabeler:
- label: 'documentation'
body:
- '/documentation/'
branch:
- '/docs\/.+/'
title:
- '/documentation/i'
- '/docs/i'
- label: 'bug'
body:
- '/bug/'
branch:
- '/bug\/.+/'
- '/fix\/.+/'
title:
- '/bug/i'
- '/fix/i'
- label: 'feature'
branch:
- '/feature\/.+/'
- '/enhancement\/.+/'
title:
- '/feature/i'
- '/feat/i'
- '/enhancement/i'
- label: 'breaking'
body:
- '/breaking/'
branch:
- '/breaking\/.+/'
title:
- '/breaking/i'
- '/major/i'

exclude-contributors:
- 'github-actions[bot]'

exclude-labels:
- 'no-changelog'

template: |
# What's Changed

$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
29 changes: 29 additions & 0 deletions .github/workflows/label-synchronization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: label-synchronization
on:
workflow_dispatch:
push:
branches:
- main
- master
paths:
- .github/labels.yaml
- .github/workflows/label-sync.yaml

permissions:
# write permission is required to edit issue labels
issues: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Synchronize labels
uses: crazy-max/ghaction-github-labeler@v5
with:
dry-run: false
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-delete: false
yaml-file: .github/labels.yaml
104 changes: 104 additions & 0 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: "pr-validation"

on:
pull_request:

permissions:
checks: write
contents: read
pull-requests: write

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

jobs:
autolabeler:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter-config.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

title-checker:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
with:
types: |
breaking
bug
docs
documentation
enhancement
feat
feature
fix
misc
security
requireScope: false
ignoreLabels: |
skip-changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.

Examples for valid PR titles:
feat(ui): Add button component.
fix: Correct typo.
_type(scope): subject._

Adding a scope is optional

Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```

# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true

label-checker:
needs: autolabeler
runs-on: ubuntu-latest
steps:
- uses: danielchabr/[email protected]
id: lint_pr_labels
with:
hasSome: breaking,bug,documentation,enhancement,feature,fix,misc,security
githubToken: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_labels.outputs.passed == false)
with:
header: pr-labels-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

The PR needs to have at least one of the following labels: breaking, bug, documentation, enhancement, feature, fix, misc, security.

# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_labels.outputs.passed != false }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-labels-lint-error
delete: true
29 changes: 29 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "release-drafter"

on:
push:
branches:
- main
- master
paths-ignore:
- .github/**
- .pre-commit-config.yaml
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE

permissions:
# write permission is required to create a github release
contents: write

jobs:
draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
publish: false
prerelease: false
config-name: release-drafter-config.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading