Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45456c4a56 | ||
|
|
df86803bc8 | ||
|
|
e2dbab855f | ||
|
|
cd05fb00d8 |
@@ -18,6 +18,8 @@ COPY src/docker-entrypoint.sh /
|
|||||||
COPY src/add-to-wiki /usr/local/bin/
|
COPY src/add-to-wiki /usr/local/bin/
|
||||||
COPY src/default.md.j2 /var/
|
COPY src/default.md.j2 /var/
|
||||||
|
|
||||||
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
|
|
||||||
WORKDIR /workdir
|
WORKDIR /workdir
|
||||||
|
|
||||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ inputs:
|
|||||||
A GitHub token to write comments and write the badge to the wiki
|
A GitHub token to write comments and write the badge to the wiki
|
||||||
(``github.token``)
|
(``github.token``)
|
||||||
required: true
|
required: true
|
||||||
|
GITHUB_WIKI:
|
||||||
|
description: >
|
||||||
|
Wiki repository clone url
|
||||||
|
required: true
|
||||||
COVERAGE_FILE:
|
COVERAGE_FILE:
|
||||||
description: >
|
description: >
|
||||||
Path and filename of the coverage XML file to analyze.
|
Path and filename of the coverage XML file to analyze.
|
||||||
@@ -64,6 +68,7 @@ runs:
|
|||||||
image: Dockerfile
|
image: Dockerfile
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
GITHUB_WIKI: ${{ inputs.GITHUB_WIKI }}
|
||||||
COVERAGE_FILE: ${{ inputs.COVERAGE_FILE }}
|
COVERAGE_FILE: ${{ inputs.COVERAGE_FILE }}
|
||||||
COMMENT_TEMPLATE: ${{ inputs.COMMENT_TEMPLATE }}
|
COMMENT_TEMPLATE: ${{ inputs.COMMENT_TEMPLATE }}
|
||||||
DIFF_COVER_ARGS: ${{ inputs.DIFF_COVER_ARGS }}
|
DIFF_COVER_ARGS: ${{ inputs.DIFF_COVER_ARGS }}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Usage $0 {owner/repo} {filename} {commit_message}
|
# Usage $0 {owner/repo} {filename} {commit_message}
|
||||||
# Stores the content of stdin in a file named {filename} in the wiki of
|
# Stores the content of stdin in a file named {filename} in the wiki of
|
||||||
# the provided repo
|
# the provided repo
|
||||||
# Reads envvar GITHUB_TOKEN
|
# Reads envvar GITHUB_WIKI
|
||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ commit_message="${3}"
|
|||||||
dir="$(mktemp -d)"
|
dir="$(mktemp -d)"
|
||||||
cd $dir
|
cd $dir
|
||||||
|
|
||||||
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${repo_name}.wiki.git" .
|
git clone "${GITHUB_WIKI}" .
|
||||||
echo $stdin > "${filename}"
|
echo $stdin > "${filename}"
|
||||||
|
|
||||||
git add "${filename}"
|
git add "${filename}"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import xmltodict
|
|||||||
|
|
||||||
MARKER = """<!-- This comment was produced by coverage-comment-action -->"""
|
MARKER = """<!-- This comment was produced by coverage-comment-action -->"""
|
||||||
SHIELD_URL = "https://img.shields.io/endpoint?url={url}"
|
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():
|
def main():
|
||||||
@@ -218,14 +218,14 @@ def post_comment(body: str, gh: github.Github, config: Config) -> None:
|
|||||||
repo = gh.get_repo(config.GITHUB_REPOSITORY)
|
repo = gh.get_repo(config.GITHUB_REPOSITORY)
|
||||||
assert config.GITHUB_PR_NUMBER
|
assert config.GITHUB_PR_NUMBER
|
||||||
issue = repo.get_issue(config.GITHUB_PR_NUMBER)
|
issue = repo.get_issue(config.GITHUB_PR_NUMBER)
|
||||||
for comment in issue.get_comments():
|
# for comment in issue.get_comments():
|
||||||
if comment.user.login == me and MARKER in comment.body:
|
# if comment.user.login == me and MARKER in comment.body:
|
||||||
print("Update previous comment")
|
# print("Update previous comment")
|
||||||
comment.edit(body=body)
|
# comment.edit(body=body)
|
||||||
break
|
# break
|
||||||
else:
|
# else:
|
||||||
print("Adding new comment")
|
print("Adding new comment")
|
||||||
issue.create_comment(body=body)
|
issue.create_comment(body=body)
|
||||||
|
|
||||||
|
|
||||||
def compute_badge(coverage_info: dict, config: Config) -> str:
|
def compute_badge(coverage_info: dict, config: Config) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user