Skip to content

Commit

Permalink
Link to git commit/run [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Oct 13, 2023
1 parent 4365e55 commit c17d1fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions _generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ def run(
publish_site: str,
source_url: str,
commit_hash: str,
commit_url: str,
run_id: str,
run_url: str,
verbose_mode: bool,
) -> None:
# set path to recipe includes in os environ so that recipes can pick it up
Expand Down Expand Up @@ -991,8 +993,8 @@ def run(
elapsed=humanize.naturaldelta(elapsed_time, minimum_unit="seconds"),
catalog=catalog_path,
source_link=(
f'<a class="git" title="Source" href="{source_url}">{commit_hash[0:7]}</a>'
f'<span class="ci-run" title="Run">{run_id}</span>'
f'<a class="git" title="Source" href="{commit_url}">{commit_hash[0:7]}</a>'
f'<a class="ci-run" title="Build Run" href="{run_url}">{run_id}</a>'
),
)
f_out.write(html_output)
Expand Down Expand Up @@ -1030,7 +1032,9 @@ def run(
parser.add_argument("publish_site", type=str, help="Deployment site url")
parser.add_argument("repo_url", type=str, help="Source repo url")
parser.add_argument("commit_hash", type=str, help="Commit hash")
parser.add_argument("commit_url", type=str, help="URL for the commit")
parser.add_argument("run_id", type=str, help="Run ID")
parser.add_argument("run_url", type=str, help="URL for the job run")
parser.add_argument(
"-v",
"--verbose",
Expand All @@ -1049,4 +1053,12 @@ def run(
if verbose:
logger.setLevel(logging.DEBUG)

run(args.publish_site, args.repo_url, args.commit_hash, args.run_id, verbose)
run(
args.publish_site,
args.repo_url,
args.commit_hash,
args.commit_url,
args.run_id,
args.run_url,
verbose,
)
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mkdir -p public meta \
&& npx babel static/theme.js --out-file static/theme.compiled.js \
&& cp -p static/theme.compiled.js public/theme.min.js \
&& npx sass -s compressed --no-source-map static/site.scss:static/site.css static/reader.scss:static/reader.css static/viewer-theme-light.scss:public/viewer-theme-light.css static/viewer-theme-dark.scss:public/viewer-theme-dark.css static/opds.scss:public/opds.css \
&& python3 _generate.py "$CI_PAGES_URL" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/" "$GITHUB_SHA" "${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" \
&& python3 _generate.py "$CI_PAGES_URL" "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/" "$GITHUB_SHA" "https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" "${GITHUB_RUN_ID}" "https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
&& node build-index.js < public/lunr_docs.json > public/lunr.json \
&& npx html-minifier-terser --input-dir public/ --output-dir public/ --collapse-whitespace --file-ext html \
&& rm -f *.recipe static/*.compiled.js public/lunr_docs.json
4 changes: 2 additions & 2 deletions static/site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ footer {
margin-right: 0.5rem;

&:before {
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="#{url-friendly-colour($base-color)}" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 4v16l13 -8z"></path></svg>');
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="#{url-friendly-colour($base-color)}" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"></path><path d="M10 9v6l5 -3z"></path></svg>');
display: inline-block;
width: 1em;
height: 1em;
Expand Down Expand Up @@ -541,7 +541,7 @@ footer {
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path fill="#{url-friendly-colour($dark-base-color)}" d="M13 21v2.5l-3-2-3 2V21h-.5A3.5 3.5 0 0 1 3 17.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-7zm0-2h6v-3H6.5a1.5 1.5 0 0 0 0 3H7v-2h6v2zm6-5V4H6v10.035A3.53 3.53 0 0 1 6.5 14H19zM7 5h2v2H7V5zm0 3h2v2H7V8zm0 3h2v2H7v-2z"/></svg>');
}
.ci-run:before {
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="#{url-friendly-colour($dark-base-color)}" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 4v16l13 -8z"></path></svg>')
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="#{url-friendly-colour($dark-base-color)}" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"></path><path d="M10 9v6l5 -3z"></path></svg>');
}
}
}
Expand Down

0 comments on commit c17d1fa

Please sign in to comment.