Skip to content

Commit 7263f69

Browse files
committed
Gitea workflow trigger
1 parent e9043c4 commit 7263f69

14 files changed

+14708
-37
lines changed

.env.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=${P
44

55
# Gitea Webhook Configuration
66
GITEA_WEBHOOK_AUTH="your_webhook_secret_here"
7+
GITEA_TOKEN="your_gitea_token_here"
8+
GITEA_BASE_URL="https://git.topcoder-dev.com/api/v1"
9+
GITEA_ORG="TC-Reviews-Tests"
10+
GITEA_REPO_DEF_BRANCH="develop"
711

812
# Kafka Configuration
913
KAFKA_BROKERS=localhost:9092

docs/GITEA_WORKFLOW_SETUP.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Gitea Workflow Setup Guide
2+
3+
New environment properties were added to support Gitea Workflows. These new properties are listed below:
4+
5+
- GITEA_TOKEN - the gitea token
6+
- GITEA_BASE_URL - gitea base URL which will be used by generated gitea client
7+
- GITEA_ORG - the gitea Org name
8+
- GITEA_REPO_DEF_BRANCH - default branch name to use when creating new repositories
9+
10+
These new properties are added in .env.sample.
11+
12+
## Gitea TS Client Generation
13+
14+
A generated gitea typescript client is used in this app. If there are new endpoints or new changes to existing endpoints, a new gitea client can be generated by running the provided script.
15+
16+
The script uses "swagger-typescript-api" which should be installed in dev dependencies. Also, take note that the generated client uses Axios to handle HTTP requests. Axios is the obvious choice as this is already part of the dependencies.
17+
18+
To generate a new client, just run:
19+
20+
```bash
21+
./generateGiteaClient.sh
22+
```
23+
24+
The script uses the following information:
25+
26+
- URL of Swagger JSON - https://git.topcoder-dev.com/swagger.v1.json
27+
- Output directory - ./src/shared/clients/gitea
28+
- Filename - gitea.client.ts
29+
30+
Any of the information above can be modified as needed.

generateGiteaClient.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
npx swagger-typescript-api generate -p https://git.topcoder-dev.com/swagger.v1.json -o ./src/shared/clients/gitea -n gitea.client.ts --axios

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
"cors": "^2.8.5",
3737
"jsonwebtoken": "^9.0.2",
3838
"jwks-rsa": "^3.2.0",
39+
"kafkajs": "^2.2.4",
3940
"lodash": "^4.17.21",
4041
"multer": "^2.0.1",
4142
"nanoid": "~5.1.2",
4243
"reflect-metadata": "^0.2.2",
4344
"rxjs": "^7.8.1",
44-
"tc-core-library-js": "appirio-tech/tc-core-library-js.git#v3.0.1",
45-
"kafkajs": "^2.2.4"
45+
"tc-core-library-js": "appirio-tech/tc-core-library-js.git#v3.0.1"
4646
},
4747
"devDependencies": {
4848
"@eslint/eslintrc": "^3.2.0",
@@ -67,6 +67,7 @@
6767
"prisma": "^6.3.1",
6868
"source-map-support": "^0.5.21",
6969
"supertest": "^7.0.0",
70+
"swagger-typescript-api": "^13.2.8",
7071
"ts-jest": "^29.2.5",
7172
"ts-loader": "^9.5.2",
7273
"ts-node": "^10.9.2",

0 commit comments

Comments
 (0)