Skip to content

Commit 7673735

Browse files
authored
Merge pull request #1 from mairror/feat/telegram_bot
feat: New telegram bot
2 parents 219afe0 + bd821b6 commit 7673735

22 files changed

+826
-0
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.dockerignore
2+
Dockerfile
3+
.hadolint.yml
4+
.git/
5+
.gitignore
6+
.isort.cfg
7+
.pre-commit-config.yaml
8+
LICENSE
9+
Makefile
10+
README.md
11+
setup.cfg
12+
**/**/__pycache__/**
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Bug report
2+
description: You've found a bug with the Mairror API.
3+
labels: ['type:bug', 'status:requirements', 'priority-5-triage']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Before you begin to fill out the form, make sure you have actually found a bug.
9+
If you're not sure then create a [discussion](https://github.com/mairror/infrastructure/discussions) first.
10+
If you have questions or want help with Mairror infrastructure, then also create a [discussion](https://github.com/mairror/infrastructure/discussions).
11+
12+
- type: dropdown
13+
id: how-are-you-running
14+
attributes:
15+
label: How are you running Mairror API?
16+
options:
17+
- 'Running without Docker'
18+
- 'Running using Docker'
19+
- 'Other'
20+
validations:
21+
required: true
22+
23+
- type: dropdown
24+
id: what-component-is-causing-the-bug
25+
attributes:
26+
label: What component is causing the bug?
27+
options:
28+
- 'Python'
29+
- 'Dependencies'
30+
- 'Bot'
31+
validations:
32+
required: true
33+
34+
- type: input
35+
id: commit-hash
36+
attributes:
37+
label: Tell us what is the commit hash you run.
38+
validations:
39+
required: false
40+
41+
- type: dropdown
42+
id: regression-error
43+
attributes:
44+
label: Was this something which used to work for you, and then stopped?
45+
options:
46+
- 'It used to work, and then stopped'
47+
- 'I never saw this working'
48+
validations:
49+
required: true
50+
51+
- type: textarea
52+
id: describe-bug
53+
attributes:
54+
label: Describe the bug
55+
description: 'Do not report any security concerns here. Email organization members instead.'
56+
validations:
57+
required: true
58+
59+
- type: textarea
60+
id: debug-logs
61+
attributes:
62+
label: Relevant debug logs
63+
description: |
64+
Try not to raise a bug report unless you've looked at the logs first.
65+
Paste the *relevant* logs here, not the entire thing and not just a link. to the dashboard (others do not have permissions to view them).
66+
value: |
67+
<details><summary>Logs</summary>
68+
69+
```
70+
Copy/paste any log here, between the starting and ending backticks
71+
```
72+
73+
</details>
74+
validations:
75+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Start a discussion (config, doubts, docs)
4+
url: https://github.com/mairror/telegram-bot/discussions/new
5+
about: If you have any questions about Mairror Telegram Bot configuration or doubts about whether you should create a feature request or bug report, or have problems with the documentation please click here to create a Discussion instead of an Issue.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Feature request
2+
description: Suggest an idea for this project.
3+
labels: ['type:feature', 'status:requirements', 'priority-5-triage']
4+
body:
5+
- type: textarea
6+
id: what-would-you-like-renovate-to-be-able-to-do
7+
attributes:
8+
label: What would you like Mairror Telegram Bot to be able to do?
9+
description: Tell us what requirements you need solving, and be sure to mention too if this is part of any bigger problem you're trying to solve.
10+
validations:
11+
required: true
12+
13+
- type: textarea
14+
id: implementation-idea-textbox
15+
attributes:
16+
label: If you have any ideas on how this should be implemented, please tell us here.
17+
description: |
18+
In case you've already dug into existing options or source code and have ideas, mention them here.
19+
Try to keep implementation ideas separate from requirements.
20+
validations:
21+
required: true
22+
23+
- type: dropdown
24+
id: interested-in-implementing-the-feature
25+
attributes:
26+
label: Is this a feature you are interested in implementing yourself?
27+
options:
28+
- 'Yes'
29+
- 'Maybe'
30+
- 'No'
31+
validations:
32+
required: true
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Refactor (internal)
2+
description: For internal use only.
3+
labels: ['type:refactor', 'status:requirements', 'priority-5-triage']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: '# This form is for Mairror maintainers only.'
8+
9+
- type: textarea
10+
id: describe-proposed-changes
11+
attributes:
12+
label: Describe the proposed change(s).
13+
description: 'Do not report any security concerns here. Email the organization members instead.'
14+
validations:
15+
required: true

.github/dependabot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates
2+
# https://sysdogs.com/articles/automating-terraform-updates-with-dependabot
3+
4+
# Set update schedule for GitHub Actions
5+
6+
version: 2
7+
updates:
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
target-branch: "main"
12+
schedule:
13+
interval: "weekly"
14+
assignees:
15+
- "aacecandev"
16+
- "blopezpi"
17+
commit-message:
18+
prefix: "[Github]"
19+
20+
# Maintain dependencies for pip on telegram bot
21+
- package-ecosystem: "pip"
22+
directory: "/src"
23+
target-branch: "main"
24+
schedule:
25+
interval: "weekly"
26+
assignees:
27+
- "aacecandev"
28+
- "blopezpi"
29+
commit-message:
30+
prefix: "[PIP]"

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Build Bot"
2+
on:
3+
push:
4+
tags:
5+
- v*.*.*
6+
7+
jobs:
8+
build-release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Set up QEMU
14+
uses: docker/setup-qemu-action@v1
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: Cache Docker layers
20+
uses: actions/cache@v2
21+
with:
22+
path: /tmp/.buildx-cache
23+
key: ${{ runner.os }}-buildx-${{ github.sha }}
24+
restore-keys: ${{ runner.os }}-buildx-
25+
26+
- name: Login to DockerHub Registry
27+
uses: docker/login-action@v1
28+
with:
29+
username: ${{ secrets.DOCKER_USERNAME }}
30+
password: ${{ secrets.DOCKER_TOKEN }}
31+
32+
- name: Push to Docker Hub
33+
uses: docker/build-push-action@v2
34+
with:
35+
platforms: linux/amd64
36+
push: true
37+
tags: |
38+
mairror/mairror-bot:${{ github.ref_name }}
39+
cache-from: type=local,src=/tmp/.buildx-cache
40+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
41+
42+
- name: Move cache
43+
run: |
44+
rm -rf /tmp/.buildx-cache
45+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Release Bot"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
new-release:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
persist-credentials: false
14+
- name: Semantic Release
15+
uses: cycjimmy/semantic-release-action@v2
16+
id: semantic
17+
with:
18+
semantic_version: "18.0.1"
19+
extra_plugins: |
20+
@semantic-release/[email protected]
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.PAT }}

.hadolint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Docker linter https://github.com/hadolint/hadolint
2+
# # https://github.com/hadolint/hadolint#rules
3+
4+
failure-threshold: warning
5+
6+
label-schema:
7+
maintainer: text
8+
9+
override:
10+
warning:
11+
- DL3049 # Label <label> is missing.
12+
info:
13+
- DL3008 # Specify version with apt-get install -y <package>=<version>
14+
- DL3013 # Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>
15+
- DL3018 # Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>
16+
- SC2174 # When used with -p, -m only applies to the deepest directory

.pre-commit-config.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-ast
6+
- id: check-byte-order-marker
7+
- id: check-case-conflict
8+
- id: check-docstring-first
9+
- id: check-executables-have-shebangs
10+
- id: check-json
11+
- id: check-yaml
12+
- id: debug-statements
13+
- id: detect-aws-credentials
14+
- id: detect-private-key
15+
- id: end-of-file-fixer
16+
- id: trailing-whitespace
17+
- id: mixed-line-ending
18+
- repo: https://github.com/psf/black
19+
rev: 20.8b1
20+
hooks:
21+
- id: black
22+
- repo: https://github.com/asottile/blacken-docs
23+
rev: v1.8.0
24+
hooks:
25+
- id: blacken-docs
26+
additional_dependencies: [black==20.8b1]
27+
- repo: https://github.com/zricethezav/gitleaks
28+
rev: v8.2.0
29+
hooks:
30+
- id: gitleaks
31+
- repo: https://github.com/asottile/seed-isort-config
32+
rev: v2.2.0
33+
hooks:
34+
- id: seed-isort-config
35+
- repo: https://github.com/pre-commit/mirrors-isort
36+
rev: v5.4.2
37+
hooks:
38+
- id: isort
39+
- repo: https://github.com/asottile/pyupgrade
40+
rev: v2.7.2
41+
hooks:
42+
- id: pyupgrade
43+
- repo: https://github.com/pre-commit/pre-commit-hooks
44+
rev: v3.2.0
45+
hooks:
46+
- id: check-ast # Is it valid Python?
47+
# Check for debugger imports and py37+ breakpoint() calls
48+
# in python source.
49+
- id: debug-statements
50+
# - repo: https://github.com/pre-commit/mirrors-mypy
51+
# # https://github.com/python/mypy
52+
# rev: v0.782
53+
# hooks:
54+
# - id: mypy
55+
# args: [--ignore-missing-imports, --no-strict-optional, --show-error-codes]
56+
- repo: https://gitlab.com/pycqa/flake8
57+
rev: '3.8.3'
58+
hooks:
59+
- id: flake8

0 commit comments

Comments
 (0)