Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
alice: please: contribute: Successful creation of meta issue linking …
Browse files Browse the repository at this point in the history
…readme issue

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Jun 22, 2022
1 parent 15edb72 commit 74f1b42
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions entities/alice/alice/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ async def contribute_readme_md(
self,
repo: AliceGitRepo,
base: "BaseBranch",
commit_message: Optional[
"ReadmeCommitMessage"
] = "Recommended Community Standard: Add README",
commit_message: "ReadmeCommitMessage",
) -> "ReadmeBranch":
# Attempt multiple commands
async for event, result in dffml.run_command_events(
Expand Down Expand Up @@ -379,10 +377,11 @@ async def readme_issue(
body,
],
logger=self.logger,
events=[dffml.Subprocess.STDOUT],
):
if event is Subprocess.STDOUT:
if event is dffml.Subprocess.STDOUT:
# The URL of the issue created
return result.strip()
return result.strip().decode()

@staticmethod
def readme_commit_message(
Expand All @@ -392,7 +391,7 @@ def readme_commit_message(
f"""
Recommended Community Standard: README
Closes: #{issue_url}
Closes: {issue_url}
"""
).lstrip()

Expand All @@ -402,7 +401,7 @@ def meta_issue_body(
repo: AliceGitRepo,
base: AlicePleaseContributeRecommendedCommunityStandardsOverlayGit.BaseBranch,
readme_path: AlicePleaseContributeRecommendedCommunityStandards.ReadmePath,
readme_issue: Optional["ReadmeIssue"] = None,
readme_issue: ReadmeIssue,
) -> "MetaIssueBody":
"""
>>> AlicePleaseContributeRecommendedCommunityStandardsGitHubIssueOverlay.meta_issue_body(
Expand All @@ -417,9 +416,14 @@ def meta_issue_body(
"""
return "\n".join(
[
f"- [x] [README]({repo.URL}/blob/{base}/{readme_path.relative_to(repo.directory).as_posix()})"
if readme_issue is None
else f"- [ ] {readme_issue}",
"- ["
+ ("x" if readme_issue is None else " ")
+ "] "
+ (
"README: " + readme_issue
if readme_issue is not None
else f"[README]({repo.URL}/blob/{base}/{readme_path.relative_to(repo.directory).as_posix()})"
),
]
)

Expand All @@ -442,10 +446,11 @@ async def create_meta_issue(
body,
],
logger=self.logger,
events=[dffml.Subprocess.STDOUT],
):
if event is Subprocess.STDOUT:
if event is dffml.Subprocess.STDOUT:
# The URL of the issue created
return result.strip()
return result.strip().decode()


# TODO Spawn background task (could use an orchestrator which creates a
Expand Down

0 comments on commit 74f1b42

Please sign in to comment.