Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Oct 19, 2023
1 parent a0b72c5 commit 1e4b516
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev101"
version = "0.0.0.dev102"
name = "RepoDynamics"
dependencies = [
"packaging >= 23.2, < 24",
Expand Down
26 changes: 22 additions & 4 deletions src/repodynamics/actions/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ def open_changelogs(self) -> tuple[str]:

class Init:

SUPPORTED_EVENTS_NON_MODIFYING = [
"issue_comment",
"issues",
"pull_request_review",
"pull_request_review_comment",
"pull_request_target",
"schedule",
"workflow_dispatch",
]
SUPPORTED_EVENTS_MODIFYING = ["pull_request", "push"]

def __init__(
self,
context: dict,
Expand Down Expand Up @@ -217,8 +228,10 @@ def __init__(
self.gh_link = pylinks.site.github.user(self.repo_owner).repo(self.repo_name)
self.meta = Meta(path_root=".", github_token=self._github_token, logger=self.logger)

self.metadata, self.metadata_ci = self.meta.read_metadata_output()
self.last_ver, self.dist_ver = self.get_latest_version()
self.metadata: dict = {}
self.metadata_ci: dict = {}
self.last_ver: PEP440SemVer | None = None
self.dist_ver: int = 0

self.summary_oneliners: list[str] = []
self.summary_sections: list[str | html.ElementCollection | html.Element] = []
Expand Down Expand Up @@ -373,6 +386,12 @@ def pull_is_internal(self) -> bool:
return self.payload["pull_request"]["head"]["repo"]["full_name"] == self.context["repository"]

def run(self):
if self.event_name in self.SUPPORTED_EVENTS_NON_MODIFYING:
self.metadata, self.metadata_ci = self.meta.read_metadata_output()
self.last_ver, self.dist_ver = self.get_latest_version()
elif self.event_name not in self.SUPPORTED_EVENTS_MODIFYING:
self.logger.error(f"Event '{self.event_name}' is not supported.")

event_handler = {
"issue_comment": self.event_issue_comment,
"issues": self.event_issues,
Expand All @@ -384,9 +403,8 @@ def run(self):
"pull_request": self.event_pull_request,
"push": self.event_push,
}
if self.event_name not in event_handler:
self.logger.error(f"Event '{self.event_name}' is not supported.")
event_handler[self.event_name]()

if self.fail:
# Just to be safe, disable publish/deploy/release jobs if fail is True
for job_id in (
Expand Down

0 comments on commit 1e4b516

Please sign in to comment.