Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hirenko-v authored Sep 19, 2024
0 parents commit cee8b9a
Show file tree
Hide file tree
Showing 28 changed files with 2,593 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Botkube maintainers (email: [email protected])
# Maintainers are listed alphabetically

* @kubeshop/botkube-dev
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug
about: Report a bug in the project
labels: bug
---

<!-- Thank you for your contribution. Before you submit the issue:
1. Search open and closed issues for duplicates.
2. Read the contributing guidelines (CONTRIBUTING.md file on root of the repository).
-->

## Description

<!-- Provide a clear and concise description of the problem.
Describe where it appears, when it occurred, and what it affects.
Provide all relevant technical details such as the Botkube version. -->

## Expected behavior

<!-- Describe what you expect to happen. -->

## Actual behavior

<!-- Describe what happens instead. -->

## Steps to reproduce

<!-- Steps to reproduce the issue. Attach all resources that can help us understand the bug, such as screenshots, links or files. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest how we can improve
labels: enhancement
---

<!-- Thank you for your contribution. Before you submit the issue:
1. Search open and closed issues for duplicates.
2. Read the contributing guidelines (CONTRIBUTING.md file on root of the repository).
-->

## Overview

<!-- Provide a clear and concise overview of the feature. -->

## Acceptance Criteria

<!-- Provide a list of conditions that must be satisfied to close this issue. -->

## Reason

<!-- Explain why we should add this feature. -->
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Thank you for your contribution. Before you submit the pull request:
1. Follow contributing guidelines, templates, the recommended Git workflow, and any related documentation.
2. Test your changes and attach their results to the pull request.
3. Update the relevant documentation.
-->

## Description

Changes proposed in this pull request:

- ...

## Related issue(s)

<!-- If you refer to a particular issue, provide its number.
To close the issue after the pull request merge, use `Resolves #123` or `Fixes #123`.
Otherwise, use `See also #123` or just `#123`. -->
98 changes: 98 additions & 0 deletions .github/workflows/pages-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Deploy Botkube plugins to GitHub Pages

on:
push:
tags:
- "*"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true

- name: Build plugins binaries
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: build --rm-dist

- name: Generate plugins index.yaml
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://${{github.repository_owner}}.github.io/${{ github.event.repository.name }}"
run: |
go run github.com/kubeshop/botkube/hack -binaries-path "./dist"
- name: Release description
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://${{github.repository_owner}}.github.io/${{ github.event.repository.name }}"
run: |
cat << EOF > README.md
Botkube Plugins **${GITHUB_REF#refs/tags/}** version are now available! :rocket:
To use plugins from this release, configure Botkube with:
EOF
cat << 'EOF' >> README.md
```yaml
plugins:
repositories:
EOF
cat << EOF >> README.md
${{ github.event.repository.name }}:
url: ${PLUGIN_DOWNLOAD_URL_BASE_PATH}/plugins-index.yaml
EOF
cat << 'EOF' >> README.md
```
EOF
- name: Render Markdown
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/markdown \
-f text="$(cat ./README.md)" > index.html
- name: Publish GitHub release
run: |
mkdir public
mv dist/executor_* public/
mv dist/source_* public/
mv plugins-index.yaml public/
mv index.html public/
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: public

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy Botkube plugins on GitHub Release

on:
push:
tags:
- '*'

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
install-only: true
version: latest

- name: Build plugins and generate plugins index.yaml
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}"
run: |
make build-plugins
make gen-plugin-index
- name: Release description
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}"
run: |
cat << EOF > release.md
Botkube Plugins **${GITHUB_REF#refs/tags/}** version are now available! :rocket:
To use plugins from this release, configure Botkube with:
EOF
cat << 'EOF' >> release.md
```yaml
plugins:
repositories:
EOF
cat << EOF >> release.md
${{ github.event.repository.name }}:
url: ${PLUGIN_DOWNLOAD_URL_BASE_PATH}/plugins-index.yaml
EOF
cat << 'EOF' >> release.md
```
EOF
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF#refs/tags/}" \
--notes-file release.md \
./dist/source_* \
./dist/executor_* \
./plugins-index.yaml
43 changes: 43 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Setting up your repository

on:
# run when branch created (repo generated from template)
create:

permissions:
contents: write

# only keep the latest run of this workflow
concurrency:
group: first-time-setup
cancel-in-progress: true

jobs:
first-time-setup:
# ensure run only once, when repo generated
if: github.run_number == 1

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set git 'user.name' and 'user.email'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Remove unneeded files
run: rm -f LICENSE CODE_OF_CONDUCT.md SECURITY.md .github/CODEOWNERS CONTRIBUTING.md

- name: Update URLs
run: |
sed -i "s/kubeshop/${{ github.repository_owner }}/g" README.md
sed -i "s/botkube-plugins-template/${{ github.event.repository.name }}/g" README.md
- name: Commit changes
run: |
git add -A
git commit -m "Setup newly created repository"
git push
38 changes: 38 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Testing
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
GOLANGCI_LINT_TIMEOUT: 5m
jobs:
cancel-previous-workflows:
name: Cancel previous workflows
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
# https://github.com/styfle/cancel-workflow-action#advanced-token-permissions
permissions:
actions: write

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5
with:
access_token: ${{ github.token }}

code-quality-test:
runs-on: ubuntu-latest

steps:
- name: "Checkout code"
uses: actions/checkout@v3
- name: "Set up Go"
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- name: "Check code quality"
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }}
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

dist/
plugins-index.yaml
/.idea/
35 changes: 35 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
run:
tests: true
linters:
disable-all: true
enable:
- revive
- unused
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- gofmt
- misspell
- gochecknoinits
- unparam
- gosec
- goimports
- whitespace
- bodyclose
- gocyclo
- gocritic

fast: false

linters-settings:
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
Loading

0 comments on commit cee8b9a

Please sign in to comment.