-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5d5ef82
Showing
18 changed files
with
5,284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TELEGRAM_BOT_TOKEN=your-telegram-bot-token | ||
GITHUB_TOKEN=your-github-token | ||
GH_REPO=user/repo | ||
|
||
# Optional | ||
ISSUE_TAGS=from:telegram,bug | ||
DEBUG=telegram-to-github-bot:* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Test"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
publish: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ github.event.workflow_run.head_repository.full_name }} | ||
ref: ${{ github.event.workflow_run.head_branch }} | ||
|
||
- name: Build and publish a Docker image for ${{ github.repository }} | ||
uses: macbre/push-to-ghcr@master | ||
with: | ||
image_name: ${{ github.repository }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
dockerfile: ./Containerfile | ||
context: . | ||
image_tag: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "**/feature/**" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.secrets | ||
.env | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeArgs": ["--loader", "ts-node/esm"], | ||
"program": "${workspaceFolder}/src/index.ts", | ||
"envFile": "${workspaceFolder}/.env", | ||
"outFiles": ["${workspaceFolder}/dist/**/*.js"] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeArgs": ["--loader", "ts-node/esm", "--inspect"], | ||
"program": "${workspaceFolder}/src/index.ts", | ||
"envFile": "${workspaceFolder}/.env", | ||
"outFiles": ["${workspaceFolder}/dist/**/*.js"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:lts-alpine | ||
|
||
WORKDIR /app | ||
|
||
# Copy package files | ||
COPY package*.json ./ | ||
|
||
# Install all dependencies | ||
RUN npm install | ||
|
||
# Copy source files | ||
COPY src ./src | ||
COPY tsconfig.json ./ | ||
|
||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Telegram to GitHub Bot | ||
|
||
--- | ||
|
||
## What It Is | ||
|
||
Telegram bot to create GitHub issues simply by `@mentioning`. Useful for "TDD" (Telegarm Driven Development) team styles. Comparing to [annndruha/issue-github-telegram-bot](https://github.com/annndruha/issue-github-telegram-bot) needs less github permissions and is more lightweight overall. | ||
|
||
## How to use | ||
|
||
You'll need to create a Telegram bot and a GitHub token. | ||
|
||
1. **Create a Telegram Bot** | ||
|
||
- Go to ['@BotFather'](https//t.me/BotFather). | ||
- Create a new bot via `/newbot` command. | ||
- Follow the instructions to set up your bot. **BotFather** will give you a **token** when your bot is created. | ||
|
||
2. **Generate a GitHub Personal Access Token** | ||
|
||
- Go to your [GitHub settings](https://github.com/settings/tokens?type=beta). | ||
- Click on **Generate new token**. | ||
- Choose `Repository access` -> `Only select repositories`. Select **repo(s)** where you want to create issues. | ||
- Add `Repository permissions` -> `Issues` -> `Read & Write`. | ||
- Click on **Generate token** and save the token. | ||
|
||
3. **Prepare Environment Variables** | ||
|
||
Keep in mind – one bot instance – one repo. So if you want to create issues in multiple repos, you'll need to create multiple bots. | ||
|
||
- Prepare env variables: | ||
```sh | ||
TELEGRAM_BOT_TOKEN=your-telegram-bot-token | ||
GITHUB_TOKEN=your-github-token | ||
GH_REPO=user/repo | ||
``` | ||
|
||
4. **Run the bot**. Here is a local example: | ||
```sh | ||
docker run --env-file .env <image-repo>/telegram-to-github-bot:latest | ||
``` | ||
5. **Add the bot to your group(s)** | ||
6. **Start creating issues!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default { | ||
preset: "ts-jest/presets/js-with-ts-esm", | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.ts$": ["ts-jest", { useESM: true }], | ||
|
||
"^.+\\.js$": "babel-jest", | ||
}, | ||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$", | ||
moduleFileExtensions: ["ts", "js", "json", "node"], | ||
extensionsToTreatAsEsm: [".ts"], | ||
testPathIgnorePatterns: ["/node_modules/", "fixtures\\.ts$"], | ||
}; |
Oops, something went wrong.