3 Commits
v1.0.2 ... v1

Author SHA1 Message Date
Rustem Khusnutdinov
45456c4a56 + 2024-11-29 01:01:59 +03:00
Rustem Khusnutdinov
df86803bc8 + 2024-11-29 00:44:40 +03:00
Rustem Khusnutdinov
e2dbab855f + 2024-11-28 23:25:30 +03:00
3 changed files with 16 additions and 11 deletions

View File

@@ -23,6 +23,10 @@ inputs:
A GitHub token to write comments and write the badge to the wiki
(``github.token``)
required: true
GITHUB_WIKI:
description: >
Wiki repository clone url
required: true
COVERAGE_FILE:
description: >
Path and filename of the coverage XML file to analyze.
@@ -64,6 +68,7 @@ runs:
image: Dockerfile
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
GITHUB_WIKI: ${{ inputs.GITHUB_WIKI }}
COVERAGE_FILE: ${{ inputs.COVERAGE_FILE }}
COMMENT_TEMPLATE: ${{ inputs.COMMENT_TEMPLATE }}
DIFF_COVER_ARGS: ${{ inputs.DIFF_COVER_ARGS }}

View File

@@ -2,7 +2,7 @@
# Usage $0 {owner/repo} {filename} {commit_message}
# Stores the content of stdin in a file named {filename} in the wiki of
# the provided repo
# Reads envvar GITHUB_TOKEN
# Reads envvar GITHUB_WIKI
set -eux
@@ -13,7 +13,7 @@ commit_message="${3}"
dir="$(mktemp -d)"
cd $dir
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${repo_name}.wiki.git" .
git clone "${GITHUB_WIKI}" .
echo $stdin > "${filename}"
git add "${filename}"

View File

@@ -17,7 +17,7 @@ import xmltodict
MARKER = """<!-- This comment was produced by coverage-comment-action -->"""
SHIELD_URL = "https://img.shields.io/endpoint?url={url}"
JSON_URL = "https://raw.githubusercontent.com/wiki/{repo_name}/{filename}"
JSON_URL = os.getenv("JSON_URL", "https://raw.githubusercontent.com/wiki/{repo_name}/{filename}")
def main():
@@ -218,14 +218,14 @@ def post_comment(body: str, gh: github.Github, config: Config) -> None:
repo = gh.get_repo(config.GITHUB_REPOSITORY)
assert config.GITHUB_PR_NUMBER
issue = repo.get_issue(config.GITHUB_PR_NUMBER)
for comment in issue.get_comments():
if comment.user.login == me and MARKER in comment.body:
print("Update previous comment")
comment.edit(body=body)
break
else:
print("Adding new comment")
issue.create_comment(body=body)
# for comment in issue.get_comments():
# if comment.user.login == me and MARKER in comment.body:
# print("Update previous comment")
# comment.edit(body=body)
# break
# else:
print("Adding new comment")
issue.create_comment(body=body)
def compute_badge(coverage_info: dict, config: Config) -> str: