Skip to content
Open
23 changes: 23 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Temporary directory to clone GitHub repository
ghrepos
# Default log file
result.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bin/runでは結果のファイルはresult.txtでなくても第3引数で指定できるようになっています。
#33 (comment) でコメントしましたが、result.txtに固定して引数で渡さないようにするのがいいかなと思っています。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは #42 で修正済み
master 側で大きい修正が入ったので、いったん master をこっちの branch にマージして、ついでに conflict の解消とかしました

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Proofreading for TensorFlow docs translation

![](https://github.com/tfug/proofreading/workflows/actions/badge.svg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このCIジョブはすべてのブランチでのpushイベントに対して発火するように設定されていますが、その結果をバッチに出すとmasterはちゃんと動作しているのにfailが表示されてしまうということになり、メンテナンスされていないかのように受け取られます。

このリポジトリ上でGithub Actionsを使って実現できそうなことは以下の3つがあります。(他にもブランチの定期削除とかもできますが)

  1. PRが出ているブランチに対するテスト
  2. mergeされたmasterブランチの内容に対するテスト
  3. on.scheduleを使って定期的にtensorflow/docsのmasterの内容をチェックする

このPRでの内容は上記の 1.と思ってレビューしましたが、バッチを出すとしたら2.3.の結果に対して出すのが良いかと思います。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たぶん今の状態だとバッジ上のステータスはブランチに関わらずデフォルトブランチである master のステータスが表示されるので、懸念しているような master 以外のブランチで CI 失敗して failed が表示されるということにはならないかと。
https://help.github.com/ja/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository


## Description

[tensorflow/docs](https://github.com/tensorflow/docs)の日本語訳の表記ゆれ等をチェックするツールです。
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -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 <repository name> <branch name> <run-type>"
echo "Usage: ./bin/run <repository name> <branch name> <run-type> <error limit (optional)>"
exit 1
fi

Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion bin/run-all
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions bin/run-diff
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ 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
notebook=${TEMP_DIR}/${GITHUB_REPOSITORY}/${file}
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
5 changes: 2 additions & 3 deletions bin/run-docker
Original file line number Diff line number Diff line change
@@ -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 $@