Skip to content

Commit

Permalink
install custom google font support
Browse files Browse the repository at this point in the history
Update plantuml.yml

Update plantuml.yml

add unzip and test font in diagram

add generated diagrams

Update README.md

check if using default commit / push resolve issue of not re-triggered jobs

let's had back the checkout?

restore

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

Update entrypoint.sh

test using gunzip

Update Dockerfile

fix google download url

Update entrypoint.sh

test download script

Update entrypoint.sh

test with Noto Font

add generated diagrams

test changes

add generated diagrams

add generated diagrams

Update backlog-item.puml

Update entrypoint.sh

test

Delete backlog-item.png

add generated diagrams

Update entrypoint.sh

test download instead of hosting it

Update entrypoint.sh
  • Loading branch information
chicco785 committed Apr 12, 2024
1 parent add88b9 commit 2422a4a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/plantuml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
23 changes: 19 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ 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
rm google-font-download
fc-cache -fv
fi

# generate
git config --global --add safe.directory ${GITHUB_WORKSPACE}
Expand All @@ -26,22 +39,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"
Expand Down Expand Up @@ -71,3 +85,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
Binary file modified sample/backlog-item.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions sample/backlog-item.puml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@startuml
skin rose
skinparam defaultFontName Barlow

object BacklogItem {
<<aggregate root>>
Expand Down

0 comments on commit 2422a4a

Please sign in to comment.