diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 0000000..b0255c9 --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,23 @@ +name: actions + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Check diff + uses: docker://tfug/proofreading:latest + with: + args: ./bin/run tensorflow/docs-l10n master 10 + + - name: Check all + uses: docker://tfug/proofreading:latest + with: + args: ./bin/run tensorflow/docs-l10n master all 10 diff --git a/.gitignore b/.gitignore index 9696cfc..e8805c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ # Temporary directory to clone GitHub repository ghrepos -# Default log file result.txt diff --git a/README.md b/README.md index 012a168..e63edfa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Proofreading for TensorFlow docs translation +![](https://github.com/tfug/proofreading/workflows/actions/badge.svg) + ## Description [tensorflow/docs](https://github.com/tensorflow/docs)の日本語訳の表記ゆれ等をチェックするツールです。 @@ -47,6 +49,8 @@ $ ./bin/run-docker tensorflow/docs master $ ./bin/run-docker tensorflow/docs master all ``` +It uses Docker image [tfug/proofreading](https://hub.docker.com/r/tfug/proofreading). + ## Why use RedPen? We are working on translation with more than one person. So It is expected that a lot of orthographical variants will occur. diff --git a/bin/run b/bin/run index e2c2371..840fce8 100755 --- a/bin/run +++ b/bin/run @@ -16,9 +16,9 @@ set -e # Check the number of arguments -if [ $# -lt 2 -o $# -gt 3 ]; then +if [ $# -lt 2 -o $# -gt 4 ]; then echo "Error: Invalid arguments" - echo "Usage: ./bin/run " + echo "Usage: ./bin/run " exit 1 fi @@ -27,12 +27,14 @@ export GITHUB_REPOSITORY_URL="https://github.com/${GITHUB_REPOSITORY}" export BRANCH=${2} TYPE=${3} export LOG_FILE=result.txt +export ERROR_LIMIT=${4:-1} # Show config echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}" echo "GITHUB_REPOSITORY_URL: ${GITHUB_REPOSITORY_URL}" echo "BRANCH: ${BRANCH}" echo "LOG_FILE: ${LOG_FILE}" +echo "ERROR_LIMIT: ${ERROR_LIMIT}" echo "" export TEMP_DIR="ghrepos" diff --git a/bin/run-all b/bin/run-all index 6e282aa..6f6d043 100755 --- a/bin/run-all +++ b/bin/run-all @@ -22,5 +22,5 @@ echo "" >> "${LOG_FILE}" files=`find ${TEMP_DIR}/${GITHUB_REPOSITORY}/site/ja -type f | grep .md` for file in ${files}; do echo "[${file}]" >> "${LOG_FILE}" - redpen --result-format plain2 ${file} >> "${LOG_FILE}" + redpen --result-format plain2 --limit ${ERROR_LIMIT} ${file} >> "${LOG_FILE}" done diff --git a/bin/run-diff b/bin/run-diff index 2916ea8..92a152e 100755 --- a/bin/run-diff +++ b/bin/run-diff @@ -25,7 +25,7 @@ for file in ${diff_files}; do if [ ${file##*.} = "md" ]; then markdown=${TEMP_DIR}/${GITHUB_REPOSITORY}/${file} echo "[${markdown}]" >> "${LOG_FILE}" - redpen --result-format plain2 ${markdown} >> "${LOG_FILE}" + redpen --result-format plain2 ${markdown} --limit ${ERROR_LIMIT} >> "${LOG_FILE}" # The case diff file is notebook elif [ ${file##*.} = "ipynb" ]; then @@ -33,7 +33,7 @@ for file in ${diff_files}; do markdown=${TEMP_DIR}/${GITHUB_REPOSITORY}/${file%.ipynb}.md jupyter nbconvert --to markdown ${notebook} echo "[${markdown}]" >> "${LOG_FILE}" - redpen --result-format plain2 ${markdown} >> "${LOG_FILE}" + redpen --result-format plain2 ${markdown} --limit ${ERROR_LIMIT} >> "${LOG_FILE}" fi done diff --git a/bin/run-docker b/bin/run-docker index b11c21d..93bfdb0 100755 --- a/bin/run-docker +++ b/bin/run-docker @@ -1,8 +1,7 @@ #!/bin/bash docker run \ - -it \ --rm \ - -v $(PWD):/usr/local/documents \ + -v $(pwd):/usr/local/documents \ tfug/proofreading \ - /bin/ash ./bin/run ${1} ${2} ${3} + /bin/ash ./bin/run $@