Skip to content
Open
15 changes: 15 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: actions

on: [push]

jobs:
build:

runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

これだとactions/checkout@v1 Dockerコンテナの上でさらにコンテナを起動することになるので、
uses: docker://tfug/proofreading:latestとして run:の中をbin/run tensorflow/docs master result.txtとしたほうが自然な気がします。

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

僕もまだ GitHub Actions あんまりちゃんとわかっていないけれど、

  • uses: actions/checkout@v1 みたいな use は処理の単位の区切り (action と呼ぶらしい) で、その単位ごとに任意のイメージを使ったり予め用意した処理を呼び出すことができる
    • Action を指していたり Docker image そのものを指していたりしてややこしい (?)
    • actions/checkout は公式に用意されているやつで CircleCI で言う checkout と同じ
    • なので後ろの RedPen による check とかは actions/checkout とは別のコンテナで動かす形になっている
      • イメージを指定しなければ ubuntu-latest 上になる

みたいな感じっぽいです。

YAML がわかり辛いなと思ったので、こんな感じで修正してみました:

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 master
    ...

- name: Check all documents
run: |
./bin/run-docker tensorflow/docs master result.txt
cat result.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Temporary directory to clone GitHub repository
ghrepos
result.txt

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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


[tensorflow/docs](https://github.com/tensorflow/docs)の日本語訳の表記ゆれ等をチェックするツールです。

## Usage
Expand Down Expand Up @@ -31,6 +33,8 @@ If you would like to use Docker, you can also execute the proofreading as
$ ./bin/run-docker tensorflow/docs master result.txt
```

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
3 changes: 1 addition & 2 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}