Commit a6922bf6 authored by Grant's avatar Grant
Browse files

fetcher: gitlab dry_run

parent de8e612a
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ def __init__(self, edition, dry_run=False):
		self.edition = edition
		self.dry_run = dry_run
		self.entry_manager = EntryManager(EDITIONS[self.edition]["entry_folder"])
		self.forge = GitlabForge()
		self.forge = GitlabForge(dry_run=dry_run)
		self.forge.from_env()
		self.git = GitUtils(dry_run=dry_run)
		self.read_ids = set()
+6 −1
Original line number Diff line number Diff line
@@ -4,8 +4,9 @@
import os

class GitlabForge(ForgeBase):
	def __init__(self):
	def __init__(self, dry_run: bool):
		self.token = None
		self.dry_run = dry_run
	
	def from_env(self):
		self.token = os.environ.get("GITLAB_CI_TOKEN")
@@ -30,6 +31,10 @@ def does_pr_already_exist(self, from_branch):
			return req.json()[0]["web_url"]
	
	def make_pr_between_branches(self, from_branch, to_branch, title, body):
		if self.dry_run:
			print("DRY RUN: would create mr " + from_branch + " onto " + to_branch + " ; " + title + " ; " + body)
			return

		url = "https://{}/api/v4/projects/{}/merge_requests".format(self.domain, self.project_id)
		req = requests.post(url, params={
			"source_branch": from_branch,