Skip to content

Commit

Permalink
feat: release changes for version 0.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
DeXtroTip committed Nov 27, 2024
1 parent cc9ef48 commit 23c1b92
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions galaxy/integrations/gitlab/.rely/mappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ resources:
openMergeRequestsCount: .openMergeRequestsCount
languages: '[.languages[].name]'
starCount: .starCount
defaultBranch: '.repository.rootRef // "main"'
defaultBranch: .repository.rootRef
updatedAt: .updatedAt
readmeUrl: 'if .repository.blobs.nodes | length > 0 then .webUrl + "/-/blob/" + (.repository.rootRef // "main") + "/" + .repository.blobs.nodes[0].path else "" end'
readmeUrl: 'if .repository.blobs.nodes | length > 0 then .webUrl + "/-/blob/" + .repository.rootRef + "/" + .repository.blobs.nodes[0].path else "" end'
readme: 'if .repository.blobs.nodes | length > 0 then .repository.blobs.nodes[0].rawBlob else "" end'
defaultBranchRequiredReviews: .requiredReviews["default"]
allBranchesRequiredReviews: .requiredReviews["All branches"]
Expand Down
3 changes: 3 additions & 0 deletions galaxy/integrations/gitlab/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ async def get_file(self, repository_path: str, file_path: str) -> dict:
async def get_commits(
self, project_id: str | int, branch: str, *, exclude_merge_commits: bool = True
) -> list[dict[str, str | int]]:
if not branch:
return []

all_commits = []

url = f"{self.config.integration.properties['url']}/v4/projects/{project_id}/repository/commits"
Expand Down
13 changes: 11 additions & 2 deletions galaxy/integrations/gitlab/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

__all__ = ["Gitlab"]

DEFAULT_BRANCH_NAME: str = "main"


class Gitlab(Integration):
_methods = []
Expand Down Expand Up @@ -91,8 +93,15 @@ async def groups(self) -> list[dict]:
async def repositories(self) -> list[dict]:
repos_mapped = []
for group_id, repositories in self.group_to_repos.items():
self.repositories.update({repo["id"]: repo for repo in repositories})
for repo in repositories:
self.repositories[repo["id"]] = repo

if repo.get("repository") is None:
repo["repository"] = {}

if repo["repository"].get("rootRef") is None:
repo["repository"]["rootRef"] = DEFAULT_BRANCH_NAME

repo["requiredReviews"] = get_required_reviews(repo.get("branchRules", []))
if self.repo_files_to_check:
repo["repoFilesChecks"] = await self.get_repo_files(repo["fullPath"])
Expand Down Expand Up @@ -294,7 +303,7 @@ async def repository_metrics(self) -> list[dict]:
all_metrics = []
for repo in self.repositories.values():
project_id = repo["id"].split("/")[-1]
commits = await self.client.get_commits(project_id, branch=repo["repository"].get("rootRef", "main"))
commits = await self.client.get_commits(project_id, branch=repo["repository"]["rootRef"])
repository_metrics = await self.mapper.process(
"repository_metrics", [{"commits": commits}], context={"repository": repo}
)
Expand Down
7 changes: 3 additions & 4 deletions galaxy/integrations/pagerduty/.rely/blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,9 @@
"title": "Incident Status",
"description": "The status of the PagerDuty incident",
"enum": [
"Active",
"Acknowledged",
"Resolved",
"Open"
"triggered",
"acknowledged",
"resolved"
]
},
"assignedVia": {
Expand Down

0 comments on commit 23c1b92

Please sign in to comment.