Fix bugs in PR-aware "Edit in GitHub" code

works around BashFAQ #050 etc.
This commit is contained in:
mDuo13
2018-03-07 15:47:59 -08:00
parent 3dae8a13a3
commit d351f409c6
4 changed files with 10 additions and 7 deletions

View File

@@ -42,12 +42,12 @@ targets:
display_name: Ripple Developer Portal
# These github_ fields are used by the template's "Edit on GitHub" link.
# Override them with --vars to change which fork/branch to edit.
github_forkurl: https://github.com/ripple/ripple-dev-portal/
github_forkurl: https://github.com/ripple/ripple-dev-portal
github_branch: master
- name: ripple.com
display_name: Ripple Developer Center
github_forkurl: https://github.com/ripple/ripple-dev-portal/
github_forkurl: https://github.com/ripple/ripple-dev-portal
github_branch: master
template: template-contentwithtoc.html
link_subs:

View File

@@ -1,10 +1,10 @@
#!/bin/bash
mkdir -p out
# Pass forward extra dactyl args if provided
# Pass forward dactyl "vars" arg if provided
if [ -n "$1" ];
then
dactyl_args=$1
dactyl_vars=$1
fi
targets=`dactyl_build -lq | awk '{print $1}'`
@@ -15,7 +15,11 @@ while read -r line; do
echo "======================================="
echo "Checking Target: $line"
rm -r out
dactyl_build -sq -t "$line" "$dactyl_args"
if [ -n "$dactyl_vars" ]; then
dactyl_build -q -t "$line" --vars "$dactyl_vars"
else
dactyl_build -q -t "$line"
fi
buildresult=$?
if [ $buildresult -eq 0 ]
then

View File

@@ -11,7 +11,7 @@ gitForkWithoutSuffix=${ghprbAuthorRepoGitUrl%.git}
if [ -n "$ghprbPullId" ];
then
dactyl_vars='--vars '"'"'{"github_forkurl": "'"$gitForkWithoutSuffix"'", "github_branch": "'"$ghprbSourceBranch"'", "github_pr_id": "'"$ghprbPullId"'"}'"'"
dactyl_vars="'"'{"github_forkurl": "'"$gitForkWithoutSuffix"'", "github_branch": "'"$ghprbSourceBranch"'", "github_pr_id": "'"$ghprbPullId"'", "is_pr_build": true}'"'"
else
dactyl_vars=""
fi

View File

@@ -58,7 +58,6 @@
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch
+ "/content/" + currentpage.md %}
{% endif %}
{% elif currentpage.template is defined %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch + "/tool/" + currentpage.template %}