autoupdater: add a timestamp to the 'ci-auto-update-sources' branch name (#2282)
This commit is contained in:
parent
1438079089
commit
d47777830d
1 changed files with 12 additions and 9 deletions
|
@ -11,7 +11,7 @@ import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from datetime import datetime
|
from datetime import datetime, time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import toml
|
import toml
|
||||||
|
@ -54,11 +54,13 @@ STRATEGIES = [
|
||||||
|
|
||||||
|
|
||||||
@cache
|
@cache
|
||||||
def get_github() -> tuple[
|
def get_github() -> (
|
||||||
Optional[tuple[str, str]],
|
tuple[
|
||||||
Optional[github.Github],
|
Optional[tuple[str, str]],
|
||||||
Optional[github.InputGitAuthor],
|
Optional[github.Github],
|
||||||
]:
|
Optional[github.InputGitAuthor],
|
||||||
|
]
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
github_login = (
|
github_login = (
|
||||||
(REPO_APPS_ROOT / ".github_login")
|
(REPO_APPS_ROOT / ".github_login")
|
||||||
|
@ -227,7 +229,8 @@ class AppAutoUpdater:
|
||||||
|
|
||||||
# Default message
|
# Default message
|
||||||
pr_title = commit_msg = "Upgrade sources"
|
pr_title = commit_msg = "Upgrade sources"
|
||||||
branch_name = "ci-auto-update-sources"
|
date = datetime.now().strftime("%y%m%d")
|
||||||
|
branch_name = f"ci-auto-update-sources-{date}"
|
||||||
|
|
||||||
for source, infos in self.sources.items():
|
for source, infos in self.sources.items():
|
||||||
update = self.get_source_update(source, infos)
|
update = self.get_source_update(source, infos)
|
||||||
|
@ -452,8 +455,8 @@ class AppAutoUpdater:
|
||||||
|
|
||||||
api: Union[GithubAPI, GitlabAPI, GiteaForgejoAPI]
|
api: Union[GithubAPI, GitlabAPI, GiteaForgejoAPI]
|
||||||
if remote_type == "github":
|
if remote_type == "github":
|
||||||
assert upstream and upstream.startswith(
|
assert (
|
||||||
"https://github.com/"
|
upstream and upstream.startswith("https://github.com/")
|
||||||
), f"When using strategy {strategy}, having a defined upstream code repo on github.com is required"
|
), f"When using strategy {strategy}, having a defined upstream code repo on github.com is required"
|
||||||
api = GithubAPI(upstream, auth=get_github()[0])
|
api = GithubAPI(upstream, auth=get_github()[0])
|
||||||
if remote_type == "gitlab":
|
if remote_type == "gitlab":
|
||||||
|
|
Loading…
Reference in a new issue