|
1 | 1 | # actions-diff-pr-management |
2 | 2 |
|
3 | | -diffを元にPRを作成するGitHub ActionsのWorkflowです。 |
| 3 | +PRのブランチに対して、フォーマッタによって修正された結果を、PRにするGitHub Actionsです。 |
| 4 | + |
| 5 | +本Actionsを使わずにフォーマットを修正した場合、自動的にPRを閉じます。 |
| 6 | + |
| 7 | +## 注意点 |
| 8 | + |
| 9 | +元のPRを閉じた場合、本Actionsが立てたPRは残ります。 |
| 10 | +このような場合、 <https://github.com/dev-hato/actions-close-pr> を併用することで自動的にPRを閉じることができます。 |
| 11 | + |
| 12 | +## 使い方 |
| 13 | + |
| 14 | +```yaml |
| 15 | +on: |
| 16 | + pull_request: |
| 17 | + |
| 18 | +jobs: |
| 19 | + diff-pr-management: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + if: github.event_name == 'pull_request' |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + ref: ${{ github.event.pull_request.head.sha }} |
| 27 | + - run: hoge fmt # FIXME フォーマッタを走らせる |
| 28 | + - uses: dev-hato/actions-diff-pr-management@v1 |
| 29 | + with: |
| 30 | + github-token: ${{secrets.GITHUB_TOKEN}} |
| 31 | + repo-name: ${{ github.event.pull_request.head.repo.full_name }} |
| 32 | +``` |
| 33 | +
|
| 34 | +## 例 |
| 35 | +
|
| 36 | +* 元のPR: <https://github.com/dev-hato/actions-diff-pr-management/pull/96> |
| 37 | +* 本Actionsによって作成されたPR: <https://github.com/dev-hato/actions-diff-pr-management/pull/98> |
| 38 | +
|
| 39 | +## 引数 |
| 40 | +
|
| 41 | +| 引数名 | 説明 | 必須 | |
| 42 | +|:---------------------:|:-------------------------------------------------------:|:---:| |
| 43 | +| github-token | GitHubのトークン。 | O | |
| 44 | +| repo-name | リポジトリ名。 `pull_request` 以外のトリガーも設定している場合はリポジトリ名を決め打ちで入力。 | O | |
| 45 | +| branch-name-prefix | branch名の接頭語。 | | |
| 46 | +| pr-title-prefix | PRのタイトルの接頭語。 | | |
| 47 | +| pr-description-prefix | 本文の接頭語。 | | |
4 | 48 |
|
5 | 49 | ## 開発 |
6 | 50 |
|
7 | 51 | ### 設定 |
8 | 52 |
|
9 | | -<https://pre-commit.com/> の手順に従って `pre-commit` をインストールする。 |
10 | | -これにより、[.pre-commit-config.yaml](.pre-commit-config.yaml)の設定に基づいて、コミット時にクレデンシャルが含まれていないかの検査が行われるようになる。 |
| 53 | +<https://pre-commit.com/> の手順に従って `pre-commit` をインストールします。 |
| 54 | +これにより、コミット時にクレデンシャルが含まれていないかの検査が行われるようになります。 |
0 commit comments