Skip to content

fix(ci): allow unit tests to run on fork PRs without app secrets - #556

Merged
wax911 merged 1 commit into
developfrom
fix/ci-fork-pr-token-access
Sep 9, 2026
Merged

wax911 merged 1 commit into
developfrom
fix/ci-fork-pr-token-access

Conversation

@wax911

@wax911 wax911 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Problem

The unit-test job had actions/create-github-app-token@v3 as its first step. For pull_request events from forks, repository secrets (APP_ID, APP_PRIVATE_KEY) are not available (Secret source: None), so the token step fails immediately:

Error: The 'client-id' (or deprecated 'app-id') input must be set to a non-empty string.

This aborts the entire job before checkout or tests run — the 6-second runtime on #552's last CI run was entirely this failure, not a test failure.

This was masked by the adopt to temurin distribution issue (#555, merged) which blocked all jobs earlier at Set up JDK. With that fixed, this second layer surfaced.

Fix

Reorder the unit-test job so tests run first:

  1. Checkout, Common setup, Run tests — execute before any token creation, so tests always run.

  2. create-github-app-token — moved after tests, with continue-on-error: true. It only feeds the JUnit report publisher; a token failure on fork PRs no longer aborts the job.

  3. Publish Test Report — uses ${{ steps.app-token.outputs.token || github.token }} to fall back to the default GITHUB_TOKEN (available on fork PRs with read permissions) when the app token is unavailable.

Verification

  • Confirmed from the live CI log that the failure is Secret source: None then The 'client-id' input must be set to a non-empty string, not a test failure.
  • The gradle-dokka job is unaffected — it already has if: github.event_name == 'push', so it never runs on PRs.
  • CI-only change; no code or test changes.

Impact

Unblocks fork PRs like #552 from running unit tests in CI. Once this merges, #552's CI should go fully green (Spotless already passing after #555, Unit Tests after this fix).

@wax911 wax911 added the bug fix label Sep 9, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions github-actions Bot 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.

Auto approved automated PR

The unit-test job had create-github-app-token as its first step, which
fails on pull_request events from forks because repository secrets are
not available. This aborted the entire job before checkout or tests
could run.

Reorder: move the token step to after test execution (it only feeds the
JUnit report publisher). Add continue-on-error so the token failure
doesn't abort the job. When the app token is unavailable (fork PRs),
fall back to the read-only GITHUB_TOKEN with annotate_only mode — the
action's documented fork-PR path that annotates without creating a
check run (which requires checks: write, unavailable on fork PRs).
@wax911
wax911 force-pushed the fix/ci-fork-pr-token-access branch from 728b1ee to 76eab45 Compare September 9, 2026 18:31
@wax911
wax911 merged commit 7c104b8 into develop Sep 9, 2026
12 of 13 checks passed
@wax911
wax911 deleted the fix/ci-fork-pr-token-access branch September 9, 2026 18:38
wax911 added a commit to yoobi/android-emojify that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant