Skip to content

Commit

Permalink
chore: update all project files, update to Go v1.21 (#51)
Browse files Browse the repository at this point in the history
* chore: update all project files, update to Go v1.21

* docs: update readme

* chore: update golang-ci
  • Loading branch information
cbrgm authored Jan 17, 2024
1 parent 4005f83 commit 321d712
Show file tree
Hide file tree
Showing 20 changed files with 609 additions and 38 deletions.
51 changes: 51 additions & 0 deletions .anvil.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"generated_at": "2024-01-16T18:00:46.781499+01:00",
"version": "v1.1.5-dirty",
"files": [
{
"path": ".editorconfig"
},
{
"path": ".github/FUNDING.yml"
},
{
"path": ".github/auto_assign.yml"
},
{
"path": ".github/issue_template.md"
},
{
"path": ".github/pull_request_template.md"
},
{
"path": ".github/renovate.json"
},
{
"path": ".github/settings.yml"
},
{
"path": ".github/workflows/autoassign.yml"
},
{
"path": ".github/workflows/automerge.yml"
},
{
"path": ".github/workflows/notify.yml"
},
{
"path": ".github/workflows/stale.yml"
},
{
"path": ".github/workflows/tag.yml"
},
{
"path": "CODEOWNERS"
},
{
"path": "CONTRIBUTING.md"
},
{
"path": "LICENSE"
}
]
}
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab
indent_size = 4

[*.go]
indent_style = tab
indent_size = 4

[*.md]
trim_trailing_whitespace = true
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

ko_fi: chrisbargmann

13 changes: 13 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- cbrgm

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 1
10 changes: 0 additions & 10 deletions .github/dependabot.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- PLEASE READ BEFORE DELETING
Please write in English, as it's a language understood by all maintainers of this project. Before submitting your issue, please take a moment to ensure it hasn't already been reported or addressed.
Additionally, we highly recommend reading our contributing guidelines to familiarize yourself with the process and increase the effectiveness of your contribution:
https://github.com/cbrgm/githubevents/blob/main/CONTRIBUTING.md
Thank you for your help and understanding!
-->
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- PLEASE READ BEFORE DELETING
Before proceeding, ensure your pull request is targeting the main branch. Clearly describe the purpose of your pull request and the issue it addresses, if applicable. We also encourage you to read our contributing guidelines for a smoother contribution process:
https://github.com/cbrgm/githubevents/blob/main/CONTRIBUTING.md
Thank you for your contribution!
-->
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>cbrgm/cbrgm//renovate/preset"
]
}
34 changes: 34 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
repository:
name: githubevents
description: GitHub webhook events toolset for Go 🚀
homepage: https://cbrgm.net
topics: github, go, golang, webhooks, events, module, webhook, codegen, go-library

private: false
has_issues: true
has_wiki: false
has_downloads: false

default_branch: main

allow_squash_merge: true
allow_merge_commit: true
allow_rebase_merge: true

allow_update_branch: true
allow_auto_merge: true
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true

branches:
- name: main
protection:
required_pull_request_reviews: null
required_status_checks:
strict: true
contexts:
- testing
enforce_admins: true
...
13 changes: 13 additions & 0 deletions .github/workflows/autoassign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: 'add-reviews'
on:
pull_request_target:
types: [opened, ready_for_review]

jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/[email protected]

...
62 changes: 62 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: automerge

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'

steps:

- name: Fetch metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.BOT_PAT_TOKEN }}

- name: Approve request
id: approve
run: gh pr review --approve ${{ github.event.pull_request.html_url }}
env:
GH_TOKEN: ${{ secrets.BOT_PAT_TOKEN }}

- name: Enable automerge
id: automerge
run: gh pr merge --rebase --auto ${{ github.event.pull_request.html_url }}
env:
GH_TOKEN: ${{ secrets.BOT_PAT_TOKEN }}

renovate:
runs-on: ubuntu-latest
if: github.actor == 'renovate[bot]'

steps:
- name: Approve request
id: approve
run: gh pr review --approve ${{ github.event.pull_request.html_url }}
env:
GH_TOKEN: ${{ secrets.BOT_PAT_TOKEN }}

- name: Enable automerge
id: automerge
run: gh pr merge --rebase --auto ${{ github.event.pull_request.html_url }}
env:
GH_TOKEN: ${{ secrets.BOT_PAT_TOKEN }}

cbrgm:
runs-on: ubuntu-latest
if: github.actor == 'cbrgm' && contains(github.event.pull_request.labels.*.name, 'auto-merge')

steps:
- name: Enable automerge
id: automerge
run: gh pr merge --rebase --auto ${{ github.event.pull_request.html_url }}
env:
GH_TOKEN: ${{ secrets.BOT_PAT_TOKEN }}
...
4 changes: 2 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.19.x
go-version: 1.21.x

- name: get modules
run: go mod vendor
Expand All @@ -28,7 +28,7 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.49
version: v1.54

- name: run tests
run: make test
24 changes: 24 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release-notification

on:
release:
types: [published]

jobs:
notify-on-release:
runs-on: ubuntu-latest
steps:
- name: Send Telegram Notification on New Release
uses: cbrgm/telegram-github-action@v1
with:
token: ${{ secrets.TELEGRAM_TOKEN }}
to: ${{ secrets.TELEGRAM_CHAT_ID }}
message: |
🚀 New Release Published!
Release Name: ${{ github.event.release.name }}
Tag: ${{ github.event.release.tag_name }}
Actor: ${{ github.actor }}
Repository: ${{ github.repository }}
Check it out: ${{ github.event.release.html_url }}
29 changes: 29 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: stale-issues-and-prs
'on':
schedule:
- cron: 0 0/3 * * *
jobs:
label-issues:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
name: Setting issue as idle
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
stale-issue-message: "This issue is idle because it has been open for 14 days with no activity."
stale-issue-label: idle
days-before-stale: 14
days-before-close: -1
operations-per-run: 100
exempt-issue-labels: backlog
- uses: actions/stale@v9
name: Setting PR as idle
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
stale-pr-message: "This PR is idle because it has been open for 14 days with no activity."
stale-pr-label: idle
days-before-stale: 14
days-before-close: -1
operations-per-run: 100
...
69 changes: 69 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: publish-release-tag

on:
schedule:
- cron: '0 0 * * 0,1,3,5' # At 00:00 (12 AM) on Sunday, Monday, Wednesday, and Friday

workflow_dispatch:
inputs:
bump-level:
required: true
type: choice
description: 'The semver bump level'
options:
- 'major'
- 'minor'
- 'patch'
- 'premajor'
- 'preminor'
- 'prepatch'
- 'prerelease'
default: 'patch'

prerelease-tag:
required: false
description: 'The tag to use for prereleases'
default: 'alpha'

jobs:
publish-release-tag:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_PAT_TOKEN }}

- name: Get Latest Tag
id: current
run: |
git fetch --tags
latest_tag=$(git tag | sort -V | tail -n 1)
echo "current version is: $latest_tag"
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- name: Bump Version
id: bump-semver
uses: cbrgm/semver-bump-action@main
with:
current-version: ${{ env.latest_tag }}
bump-level: ${{ github.event.inputs.bump-level || 'patch' }}
prerelease-tag: ${{ github.event.inputs.prerelease-tag }}

- name: Publish Git Tag
run: |
git fetch --tags
latest_tag=$(git tag | sort -V | tail -n 1)
new_tag=${{ steps.bump-semver.outputs.new_version }}
if [[ $(git rev-list $latest_tag..HEAD --count) -gt 0 ]]; then
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag $new_tag
git push origin $new_tag
else
echo "No new commits since last tag. Skipping tag push. ($new_tag)"
fi
...
3 changes: 2 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
# the repo. Unless a later match takes precedence,
# mentioned account names will be requested for
# review when someone opens a pull request.
* @cbrgm
* @cbrgm

Loading

0 comments on commit 321d712

Please sign in to comment.