Lint2 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
pull_request_target: | |
permissions: | |
pull-requests: write | |
jobs: | |
textlint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.head_ref }} | |
# プルリクエスト元リポジトリからプルリクエスト作成時のプルリクエスト先baseブランチの最新コミットを取得 | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.base.sha }} | |
# プルリクエスト作成時のプルリクエスト先baseブランチの最新コミットとプルリクエスト先headブランチの最新コミットを比較 | |
- name: modified files | |
run: | | |
modified_files=$(git diff --name-only --diff-filter=AM origin/${{ github.event.pull_request.base.sha }}..origin/${{ github.head_ref }} | tr '\n' ' ') | |
echo "textlint_flags=$modified_files" >> $GITHUB_ENV | |
- uses: tsuyoshicho/action-textlint@v3 | |
with: | |
fail_on_error: true | |
textlint_flags: ${{ env.textlint_flags }} |