Merged
Conversation
…r-2 into feat/nose/rails-lint
nose221834
reviewed
Sep 14, 2025
Comment on lines
+29
to
+32
| # 同じブランチ(ref)の並行実行を抑止(後から来た実行を優先) | ||
| concurrency: | ||
| group: rubocop-${{ github.ref }} | ||
| cancel-in-progress: true |
Comment on lines
67
to
84
|
|
||
| # ② 自動修正の差分があればコミット&push | ||
| # - push のとき:そのまま | ||
| # - PR のとき:同一リポのブランチ(フォーク以外)のみ push 許可 | ||
| # - [skip ci]: そのコミットで再度 CI を走らせない抑制用タグ | ||
| - name: Commit auto-fixed files | ||
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name) | ||
| run: | | ||
| if ! git diff --quiet; then | ||
| git config user.name "github-actions[bot]" # bot としてコミット | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add api/ | ||
| git commit -m "chore(rubocop): auto fix (-A) [skip ci]" | ||
| git push | ||
| else | ||
| echo "No changes to commit." | ||
| fi | ||
|
|
Collaborator
There was a problem hiding this comment.
これ、短くできます
おそらく下の感じでいける
https://github.com/NUTFes/group-manager-2/blob/gm3/develop/.github/workflows/user-code-quality.yml
# 変更があれば、コミット&プッシュする
- name: Commit formatted files
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Action
author_email: action@github.com
message: "chore: auto format code"
push: true
…up-manager-2 into feat/harata/rails-lint-and-ci
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
対応Issue
resolve #0
概要
実装詳細
RuboCopの導入
api/GemfileにRuboCopを追加.rubocop.ymlでRuboCopの設定をカスタマイズ.rubocop_todo.ymlで既存の違反を一時的に無視コードの自動修正
Style/FrozenStringLiteralComment、Style/SymbolArray等のスタイル違反を修正dependent: :destroyの追加等の機能改善GitHub Actionsワークフローの実装
api-code-quality.ymlでRuboCop自動修正・チェック機能を追加push:api/**変更時に起動(全ブランチ)。pull_request: ベースgm3/developかつapi/**変更時に起動。rubocop -A --no-serverを実行(ここでは失敗させず、自動修正のみ適用)。[skip ci]を付与してループ抑止。rubocop --parallel --format githubで最終チェック(残違反があればジョブを fail。PR には行内アノテーションが表示される)。concurrencyにより同一 ref の並行実行をキャンセル。if: github.actor != 'github-actions[bot]'で bot の自動コミットによる再実行をスキップ。github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>。画面スクリーンショット等
テスト項目
api/**を変更した PR / push でワークフローが起動する。備考