diff --git a/.github/workflows/plantuml.yml b/.github/workflows/plantuml.yml index c9575eb..3069661 100644 --- a/.github/workflows/plantuml.yml +++ b/.github/workflows/plantuml.yml @@ -8,8 +8,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: generate and commit diagrams - uses: abekoh/commit-plantuml-action@1.0.3 + uses: zaphiro-technologies/commit-plantuml-action@install-google-fonts with: botEmail: ${{ secrets.BOT_EMAIL }} botGithubToken: ${{ secrets.GITHUB_TOKEN }} enableReviewComment: true + installGoogleFont: Barlow:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i diff --git a/README.md b/README.md index 15fbe15..7fa6a4d 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ jobs: botEmail: ${{ secrets.BOT_EMAIL }} botGithubToken: ${{ secrets.GITHUB_TOKEN }} enableReviewComment: true + installGoogleFont: Barlow ``` You must set `actions/checkout` before this step, to get source codes. @@ -41,3 +42,11 @@ To add review comment. Use default [`secrets.GITHUB_TOKEN`](https://docs.github. required: false, default: false If set `true`, diff png files' information are submitted to pull request. + +### installGoogleFont + +required: false + +If set, the value will be use to download and install a font family from +[google](https://fonts.google.com/). To be used in combination with `skinparam +defaultFontName` and other FontName skin settings for plantuml. diff --git a/action.yml b/action.yml index 2992c57..187bf0a 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,10 @@ inputs: enableReviewComment: description: "whether post review comment or not" required: false - default: false + default: "false" + installGoogleFont: + description: "Google Font family to be installed" + required: false runs: using: "docker" image: "Dockerfile" diff --git a/entrypoint.sh b/entrypoint.sh index b22f77e..4932ae3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,6 +13,18 @@ if [[ "${INPUT_ENABLEREVIEWCOMMENT}" = "true" && ! "${INPUT_BOTGITHUBTOKEN}" ]]; echo "ERROR: Please set inputs.botGithubToken" exit 1 fi +if [ -z "$INPUT_INSTALLGOOGLEFONT" ]; then + echo "No font family defined" +else + echo "Installing $INPUT_INSTALLGOOGLEFONT" + wget https://raw.githubusercontent.com/neverpanic/google-font-download/master/google-font-download -O google-font-download + chmod +x google-font-download + ./google-font-download -f ttf --url="https://fonts.google.com/?selection.family=$INPUT_INSTALLGOOGLEFONT" + mkdir /usr/share/fonts/googlefonts + mv *.ttf /usr/share/fonts/googlefonts + rm *.css + fc-cache -fv +fi # generate git config --global --add safe.directory ${GITHUB_WORKSPACE} @@ -26,22 +38,23 @@ done # commit if [[ ! $(git status --porcelain) ]]; then + echo "No changes to commit" exit 0 fi -git config user.name "${GITHUB_ACTOR}" -git config user.email "${INPUT_BOTEMAIL}" +git config --global user.name "${GITHUB_ACTOR}" +git config --global user.email "${INPUT_BOTEMAIL}" git checkout ${GITHUB_HEAD_REF} git add . git commit -m "add generated diagrams" -git push origin HEAD:${GITHUB_HEAD_REF} echo "comitted png files" # add review comment if [[ "${INPUT_ENABLEREVIEWCOMMENT}" != "true" ]]; then + git push exit 0 fi git fetch -GITHUB_SHA_AFTER=$(git rev-parse origin/${GITHUB_HEAD_REF}) +GITHUB_SHA_AFTER=$(git rev-parse HEAD) DIFF_FILES=`git diff ${GITHUB_SHA} ${GITHUB_SHA_AFTER} --name-only | grep ".png"` echo $DIFF_FILES BODY="## Diagrams changed\n" @@ -71,3 +84,4 @@ curl -X POST \ -d "{\"event\": \"COMMENT\", \"body\": \"${BODY}\"}" \ "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${PULL_NUM}/reviews" echo "added review comments" +git push diff --git a/sample/backlog-item.png b/sample/backlog-item.png index c00c20d..0e3f890 100644 Binary files a/sample/backlog-item.png and b/sample/backlog-item.png differ diff --git a/sample/backlog-item.puml b/sample/backlog-item.puml index 505915a..66b9c3f 100644 --- a/sample/backlog-item.puml +++ b/sample/backlog-item.puml @@ -1,5 +1,6 @@ @startuml skin rose +skinparam defaultFontName Barlow object BacklogItem { <>