Skip to content

add renovate#1221

Merged
pirosiki197 merged 2 commits into
mainfrom
add-renovate
May 19, 2026
Merged

add renovate#1221
pirosiki197 merged 2 commits into
mainfrom
add-renovate

Conversation

@y33550336

@y33550336 y33550336 commented May 11, 2026

Copy link
Copy Markdown
Contributor

なぜやるか

renovateをとりあえず導入して動くかどうか

やったこと

おそらく動く形で導入
portalリポジトリを参照
(https://github.com/traPtitech/portal/pull/397/changes#diff-b445d5313b5628d2bf175b2af0a3c9417e131d068126930edd61266daed59e40R1-R3)

やらなかったこと

renovateのファイルは分割しなかった

資料

なし

Summary by CodeRabbit

  • Chores
    • Renovateを用いた自動依存関係更新機能の環境構築が完了しました。スケジュール実行、手動トリガー、CI完了時の実行に対応します。プロジェクトの依存関係が自動的に検出・更新・管理されるようになります。

Review Change Stack

@github-actions

Copy link
Copy Markdown
Contributor

Preview (prod backend + PR dashboard) → https://1221.ns-preview.trapti.tech/

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6286c58f-be44-4d30-92d2-9baa85881840

📥 Commits

Reviewing files that changed from the base of the PR and between 94e7d4e and a20871c.

📒 Files selected for processing (2)
  • .github/renovate-bot.json5
  • .github/workflows/renovate.yaml
✅ Files skipped from review due to trivial changes (1)
  • .github/renovate-bot.json5
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/renovate.yaml

📝 Walkthrough

ウォークスルー

Renovateボット統合を実装する。新しい設定ファイルがボットの認証情報とリポジトリスコープを定義し、GitHub Actionsワークフローがスケジュール・手動・CI完了・mainプッシュでRenovateを実行する。

変更内容

Renovate Bot統合

Layer / File(s) Summary
Renovate設定ファイル
.github/renovate-bot.json5
スキーマURL、ボットユーザー名、gitAuthor、および traPtitech/NeoShowcase のリポジトリホワイトリストを定義。
ワークフロー定義と実行トリガー
.github/workflows/renovate.yaml (行1-35)
ワークフロー名、contents: write権限、手動ディスパッチ入力(dryRun、logLevel)、workflow_run(CI完了)、cron(0 20 * * *)、およびmainへのプッシュのトリガーを設定。デフォルト環境変数(LOG_LEVEL、RENOVATE_DRY_RUN、RENOVATE_CONFIG_FILE)を定義。
ジョブ定義と条件分岐
.github/workflows/renovate.yaml (行36-42)
renovateジョブのランナーをubuntu-latestに設定し、workflow_runイベント発火時にrenovate/プレフィックス以外を除外するif条件を追加。
認証とリポジトリ準備
.github/workflows/renovate.yaml (行43-57)
GitHub Appからトークンを生成し、actions/checkoutでリポジトリを取得。手動入力がある場合にGITHUB_ENVRENOVATE_DRY_RUNLOG_LEVELを上書きする処理を追加。
Renovate実行
.github/workflows/renovate.yaml (行58-64)
renovatebot/github-action@v46.1.6を実行し、RENOVATE_CONFIG_FILEで指定したJSON5設定と生成トークンでRenovateを起動する。

推定レビュー工数

🎯 2 (Simple) | ⏱️ ~10分

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive タイトル「add renovate」は非常に簡潔ですが、変更内容は明確にはっきりしておらず、Renovateの導入という一般的な説明に留まっており、詳細性に欠けています。 より具体的なタイトル例として「Add Renovate workflow and configuration」や「Set up Renovate bot for dependency updates」などの形で、何を追加したのか、その目的や意義がより明確に伝わるタイトルへの改善を検討してください。
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed PR説明はテンプレートの主要セクション(なぜやるか、やったこと、やらなかったこと)がすべて記載されており、Renovate導入の意図、参照したリポジトリ、設定ファイルの非分割という設計判断が明確に述べられています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-renovate

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/renovate.yaml:
- Line 41: The current workflow_run if condition only checks head_branch prefix
and allows runs from forks to satisfy the guard; update the condition on that
line to also require the run originated from the same repository by adding a
check that github.event.workflow_run.head_repository.full_name ==
github.repository (combine with the existing startsWith check using && inside
the negated expression) so secrets like RENOVATE_APP_ID and
RENOVATE_APP_PRIVATE_KEY are only exposed for runs from the same repo.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9f31731d-b176-4657-8acc-eda5dcc036a5

📥 Commits

Reviewing files that changed from the base of the PR and between 9f6c181 and 94e7d4e.

📒 Files selected for processing (2)
  • .github/renovate-bot.json5
  • .github/workflows/renovate.yaml

name: Renovate
runs-on: ubuntu-latest
# Exclude dispatch from non-renovate checks
if: ${{ !(github.event_name == 'workflow_run' && !startsWith(github.event.workflow_run.head_branch, 'renovate/')) }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

GitHub Actions workflow_run secrets security best practices head_repository.full_name same repository check

💡 Result:

For GitHub Actions workflows triggered by the workflow_run event, which can access repository secrets even if the triggering workflow could not (e.g., from a fork), a key security best practice is to verify that the triggering workflow originated from the same repository before using secrets or performing sensitive actions. This prevents potential supply chain attacks where a malicious workflow in a forked repository triggers a privileged downstream workflow. Use a job-level or step-level if condition to check if the head repository (where the triggering workflow ran) matches the current repository: if: ${{ github.event.workflow_run.head_repository.full_name == github.repository }} Example workflow snippet: on: workflow_run: workflows: ["build"] # Specific triggering workflow(s) types: [completed] branches: [main] # Restrict to trusted branches [1][2][3] jobs: deploy: if: >- github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.full_name == github.repository runs-on: ubuntu-latest permissions: contents: read # Use minimal permissions [4][5] steps: - uses: actions/checkout@v4 - name: Deploy run: echo "Using secrets safely" env: SECRET: ${{ secrets.MY_SECRET }} Additional best practices for secrets in workflow_run contexts [4][6][7][8][3]: - Set default workflow permissions to read-only contents: permissions: { contents: read } at workflow level. - Filter strictly: specify workflows, branches, and require success conclusion. - Use OIDC for cloud credentials instead of long-lived secrets [4][9]. - Pin actions to full SHA commits. - Audit and rotate secrets regularly [6][7]. - Avoid logging secrets; use::add-mask:: [4]. The github.event.workflow_run object mirrors the workflow_run webhook payload, which includes head_repository (the repo of the commit that triggered the upstream workflow) with full_name property, analogous to pull_request.head.repo.full_name used in PR security checks [10][11][12][13].

Citations:


🏁 Script executed:

#!/bin/bash
# Find and examine the renovate workflow file
find . -name "renovate.yaml" -o -name "renovate.yml" | head -5

Repository: traPtitech/NeoShowcase

Length of output: 100


🏁 Script executed:

#!/bin/bash
# Examine the renovate.yaml file to see the full context
cat -n .github/workflows/renovate.yaml | head -60

Repository: traPtitech/NeoShowcase

Length of output: 2165


🏁 Script executed:

#!/bin/bash
# Check the rest of the file to see what secrets are used and the full job definition
cat -n .github/workflows/renovate.yaml | tail -20

Repository: traPtitech/NeoShowcase

Length of output: 1115


workflow_run の許可条件が不十分で、シークレット利用ジョブへの権限昇格攻撃に対して脆弱です。

Line 41 の条件は head_branch の接頭辞のみで判定しており、トリガー元が同一リポジトリかを検証していません。フォークされたリポジトリからのワークフロー実行でも条件を満たし、RENOVATE_APP_ID および RENOVATE_APP_PRIVATE_KEY シークレットが露出する可能性があります。github.event.workflow_run.head_repository.full_name == github.repository を条件に追加してください。

修正例
-    if: ${{ !(github.event_name == 'workflow_run' && !startsWith(github.event.workflow_run.head_branch, 'renovate/')) }}
+    if: ${{ github.event_name != 'workflow_run' || (
+      startsWith(github.event.workflow_run.head_branch, 'renovate/') &&
+      github.event.workflow_run.head_repository.full_name == github.repository
+    ) }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/renovate.yaml at line 41, The current workflow_run if
condition only checks head_branch prefix and allows runs from forks to satisfy
the guard; update the condition on that line to also require the run originated
from the same repository by adding a check that
github.event.workflow_run.head_repository.full_name == github.repository
(combine with the existing startsWith check using && inside the negated
expression) so secrets like RENOVATE_APP_ID and RENOVATE_APP_PRIVATE_KEY are
only exposed for runs from the same repo.

@Pugma Pugma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

僕も確認しました! よさそうです 👍

@pirosiki197 pirosiki197 merged commit 8eb7d8d into main May 19, 2026
7 checks passed
@pirosiki197 pirosiki197 deleted the add-renovate branch May 19, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants