diff --git a/.gitea/workflows/miflow.yml b/.gitea/workflows/miflow.yml index 11f6585..35d7ac1 100644 --- a/.gitea/workflows/miflow.yml +++ b/.gitea/workflows/miflow.yml @@ -24,5 +24,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v4 with: + context: . + file: docker/Dockerfile push: true tags: micr.cloud.mioffice.cn/egg/gitlab_monitor:${{ github.sha }} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 90e78e6..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM micr.cloud.mioffice.cn/zhaoyingbo/bun:alpine-cn - -WORKDIR /app - -COPY package*.json ./ - -COPY bun.lockb ./ - -RUN bun install - -COPY . . - -CMD ["bun", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 36686d7..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "3" - -services: - gitlab_monitor: - image: git.yingbo.im:333/zhaoyingbo/gitlab_monitor:sha - container_name: gitlab_monitor - restart: always - ports: - - 3001:3000 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..7a62828 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,15 @@ +FROM oven/bun:1-alpine + +RUN /bin/sh -c apk update && apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone + +WORKDIR /app + +COPY package*.json ./ + +COPY bun.lockb ./ + +RUN bun install + +COPY . . + +CMD ["bun", "start"] \ No newline at end of file diff --git a/service/gitlab/mr.ts b/service/gitlab/mr.ts new file mode 100644 index 0000000..108e905 --- /dev/null +++ b/service/gitlab/mr.ts @@ -0,0 +1,20 @@ +import netTool from "../netTool" +import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools" + +const getDiffs = async (project_id: number, merge_request_iid: number) => { + const URL = `${GITLAB_BASE_URL}/projects/${project_id}/merge_requests/${merge_request_iid}/changes` + const res = await gitlabReqWarp( + () => netTool.get(URL, {}, GITLAB_AUTH_HEADER), + null + ) + if (res === null) return null + return res +} + +const mr = { + getDiffs, +} + +export default mr + +getDiffs(139032, 484).then(console.log)