Loading .gitlab-ci.yml +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ lemmy fetcher: - git remote add origin https://oauth2:${GITLAB_CI_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git script: - python ./tools/lemmy_fetcher.py - ls -la .fetcher cache: key: lemmy-fetcher paths: Loading tools/lib/gitlab_forge.py +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,13 @@ def from_env(self): self.domain = os.environ.get("CI_SERVER_HOST") self.project_id = os.environ.get("CI_PROJECT_ID") if not self.token: raise Exception("Gitlab token is not available") if not self.domain: raise Exception("Gitlab domain is not available") if not self.project_id: raise Exception("Gitlab project id is not available") def does_pr_already_exist(self, from_branch): url = "https://{}/api/v4/projects/{}/merge_requests?state=opened&source_branch={}&target_branch={}".format(self.domain, self.project_id, from_branch, "main") req = requests.get(url) Loading Loading
.gitlab-ci.yml +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ lemmy fetcher: - git remote add origin https://oauth2:${GITLAB_CI_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git script: - python ./tools/lemmy_fetcher.py - ls -la .fetcher cache: key: lemmy-fetcher paths: Loading
tools/lib/gitlab_forge.py +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,13 @@ def from_env(self): self.domain = os.environ.get("CI_SERVER_HOST") self.project_id = os.environ.get("CI_PROJECT_ID") if not self.token: raise Exception("Gitlab token is not available") if not self.domain: raise Exception("Gitlab domain is not available") if not self.project_id: raise Exception("Gitlab project id is not available") def does_pr_already_exist(self, from_branch): url = "https://{}/api/v4/projects/{}/merge_requests?state=opened&source_branch={}&target_branch={}".format(self.domain, self.project_id, from_branch, "main") req = requests.get(url) Loading