Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/verify-firebase-functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Verify Firebase Functions

on:
pull_request:
branches: [main, develop]

jobs:
firebase:
runs-on: ubuntu-latest
defaults:
run:
working-directory: openci-runner/firebase/functions

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies for firebase-functions
- run: npm ci

- name: Install dependencies for github-apps
working-directory: openci-runner/github-apps
run: npm ci

- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SA_KEY }}

- name: Dry-run check via Emulator on PRs
run: |
npx firebase-tools emulators:exec \
--only functions \
--project ${{ secrets.FIREBASE_PROJECT_ID }} \
"npm run build"
Comment on lines +28 to +37
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

フォーク PR では secrets が使えず常に失敗します。

pull_request イベントではフォークからの PR にリポジトリ secrets が供給されないため、google-github-actions/auth が空の credentials_json で失敗し、以降の FIREBASE_PROJECT_ID 参照もエラーとなります。外部コントリビューションを想定するなら、このジョブをフォーク PR ではスキップするなどのガードが必須です。

例:

 jobs:
   firebase:
+    if: github.event.pull_request.head.repo.fork == false
     runs-on: ubuntu-latest

もしくは secrets を必要としない別経路での検証をご検討ください。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SA_KEY }}
- name: Dry-run check via Emulator on PRs
run: |
npx firebase-tools emulators:exec \
--only functions \
--project ${{ secrets.FIREBASE_PROJECT_ID }} \
"npm run build"
jobs:
firebase:
if: github.event.pull_request.head.repo.fork == false
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SA_KEY }}
- name: Dry-run check via Emulator on PRs
run: |
npx firebase-tools emulators:exec \
--only functions \
--project ${{ secrets.FIREBASE_PROJECT_ID }} \
"npm run build"
🤖 Prompt for AI Agents
.github/workflows/verify-firebase-functions.yml lines 23-32: the workflow fails
for fork PRs because repo secrets are unavailable; guard the job (or at least
the auth step) so it is skipped for forked pull requests by adding an
if-condition checking that either the event is not a pull_request or that
github.event.pull_request.head.repo.fork == false (i.e., the PR originates from
the same repo), and alternatively provide a separate non-secret-dependent
verification path for fork contributions if needed.

1 change: 1 addition & 0 deletions openci-controller.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"serayuzgur",
"serde",
"simonsiefke",
"smee",
"sqlfluff",
"sqlx",
"tamasfe",
Expand Down
Loading