Skip to content

Commit 132c5d6

Browse files
authored
feat(trunk): add trunk + workflows (#60)
## what - Adds trunk's config for this repo. - Adds trunk workflows for linting + upgrading trunk configs - Adds renovate - Adds CODEOWNERS ## why - Other PRs are blocked because we're requiring the `lint` GHA check. This repo never got updated to include that so fixing that now 👍 ## references - See this blog post PR which is blocked due to the `lint` requirement: #49
1 parent 582119b commit 132c5d6

10 files changed

+207
-0
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Use this file to define individuals or teams that are responsible for code in a repository.
2+
# Read more: <https://help.github.com/articles/about-codeowners/>
3+
#
4+
# Order is important: the last matching pattern takes the most precedence
5+
6+
# These owners will be the default owners for everything
7+
* @masterpointio/masterpoint-open-source

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## what
2+
3+
- Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
4+
- Use bullet points to be concise and to the point.
5+
6+
## why
7+
8+
- Provide the justifications for the changes (e.g. business case).
9+
- Describe why these changes were made (e.g. why do these commits fix the problem?)
10+
- Use bullet points to be concise and to the point.
11+
12+
## references
13+
14+
- Link to any supporting GitHub issues or helpful documentation to add some context (e.g. Stackoverflow).
15+
- Use `closes #123`, if this PR closes a GitHub issue `#123`

.github/renovate.json5

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"extends": [
3+
"config:best-practices",
4+
"github>aquaproj/aqua-renovate-config#2.7.5"
5+
],
6+
"enabledManagers": [
7+
"github-actions"
8+
],
9+
"schedule": [
10+
"after 9am on the first day of the month"
11+
],
12+
"assigneesFromCodeOwners": true,
13+
"dependencyDashboardAutoclose": true,
14+
"addLabels": ["{{manager}}"],
15+
"packageRules": [
16+
{
17+
"matchManagers": ["github-actions"],
18+
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
19+
"automerge": true,
20+
"automergeType": "branch",
21+
"groupName": "github-actions-auto-upgrade",
22+
"addLabels": ["auto-upgrade"]
23+
},
24+
{
25+
"matchManagers": ["github-actions"],
26+
"matchUpdateTypes": ["major"],
27+
"groupName": "github-actions-needs-review",
28+
"addLabels": ["needs-review"]
29+
}
30+
]
31+
}

.github/workflows/lint.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint
2+
3+
concurrency:
4+
group: lint-${{ github.head_ref || github.run_id }}
5+
cancel-in-progress: true
6+
7+
on: pull_request
8+
9+
permissions:
10+
actions: read
11+
checks: write
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out Git repository
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
- name: Trunk Check
22+
uses: trunk-io/trunk-action@4d5ecc89b2691705fd08c747c78652d2fc806a94 # v1.1.19
23+
24+
conventional-title:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/trunk-upgrade.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Trunk Upgrade
2+
3+
on:
4+
schedule:
5+
# On the first day of every month @ 8am
6+
- cron: 0 8 1 * *
7+
workflow_dispatch: {}
8+
9+
permissions: read-all
10+
11+
jobs:
12+
trunk-upgrade:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
# For trunk to create PRs
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Create Token for MasterpointBot App
23+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a #v2.1.0
24+
id: generate-token
25+
with:
26+
app_id: ${{ secrets.MP_BOT_APP_ID }}
27+
private_key: ${{ secrets.MP_BOT_APP_PRIVATE_KEY }}
28+
29+
- name: Upgrade
30+
id: trunk-upgrade
31+
uses: trunk-io/trunk-action/upgrade@4d5ecc89b2691705fd08c747c78652d2fc806a94 # v1.1.19
32+
with:
33+
github-token: ${{ steps.generate-token.outputs.token }}
34+
reviewers: "@masterpointio/masterpoint-internal"
35+
prefix: "chore: "
36+
37+
- name: Merge PR automatically
38+
if: steps.trunk-upgrade.outputs.pull-request-number != ''
39+
env:
40+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
41+
PR_NUMBER: ${{ steps.trunk-upgrade.outputs.pull-request-number }}
42+
run: |
43+
gh pr merge "$PR_NUMBER" --squash --auto --delete-branch

.trunk/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*out
2+
*logs
3+
*actions
4+
*notifications
5+
*tools
6+
plugins
7+
user_trunk.yaml
8+
user.yaml
9+
tmp

.trunk/configs/.markdownlint.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Autoformatter friendly markdownlint config (all formatting rules disabled)
2+
default: true
3+
blank_lines: false
4+
bullet: false
5+
html: false
6+
indentation: false
7+
line_length: false
8+
spaces: false
9+
url: false
10+
whitespace: false
11+
12+
# Disable MD025: Multiple top-level headings in the same file
13+
MD025: false

.trunk/configs/.yamllint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
quoted-strings:
3+
required: only-when-needed
4+
extra-allowed: ["{|}"]
5+
empty-values:
6+
forbid-in-block-mappings: true
7+
forbid-in-flow-mappings: true
8+
key-duplicates: {}
9+
octal-values:
10+
forbid-implicit-octal: true

.trunk/configs/svgo.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
plugins: [
3+
{
4+
name: "preset-default",
5+
params: {
6+
overrides: {
7+
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
8+
sortAttrs: true,
9+
removeOffCanvasPaths: true,
10+
},
11+
},
12+
},
13+
],
14+
};

.trunk/trunk.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: 0.1
2+
cli:
3+
version: 1.22.15
4+
plugins:
5+
sources:
6+
- id: trunk
7+
ref: v1.6.8
8+
uri: https://github.com/trunk-io/plugins
9+
lint:
10+
enabled:
11+
- checkov@3.2.427
12+
- trufflehog@3.88.30
13+
- git-diff-check
14+
- gitleaks@8.26.0
15+
- markdownlint@0.45.0
16+
- oxipng@9.1.5
17+
- prettier@3.5.3
18+
- svgo@3.3.2
19+
- taplo@0.9.3
20+
- yamllint@1.37.1
21+
ignore:
22+
- linters: [ALL]
23+
paths:
24+
- "**/PULL_REQUEST_TEMPLATE.md"
25+
runtimes:
26+
enabled:
27+
- go@1.21.0
28+
- node@18.20.5
29+
- python@3.10.8
30+
actions:
31+
disabled:
32+
- trunk-announce
33+
- trunk-check-pre-push
34+
- trunk-fmt-pre-commit
35+
enabled:
36+
- trunk-upgrade-available

0 commit comments

Comments
 (0)