-
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 f25e608
Showing
18 changed files
with
5,306 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,49 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Test"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ github.event.workflow_run.head_repository.full_name }} | ||
ref: ${{ github.event.workflow_run.head_branch }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract version and commit hash | ||
id: version | ||
run: | | ||
echo "VERSION=$(jq -r .version < package.json)-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "SHORT_SHA=${{ github.sha }}" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest, | ||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.VERSION }}, | ||
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.VERSION }}-$(echo ${{ env.SHORT_SHA }} | head -c 8) |
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: | ||
build: | ||
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,2 @@ | ||
.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,16 @@ | ||
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 ./ | ||
COPY .env ./ | ||
|
||
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.