Skip to content

Bob/ci fork pr support#164

Closed
0xbrayo wants to merge 5 commits into
ActivityWatch:masterfrom
0xbrayo:bob/ci-fork-pr-support
Closed

Bob/ci fork pr support#164
0xbrayo wants to merge 5 commits into
ActivityWatch:masterfrom
0xbrayo:bob/ci-fork-pr-support

Conversation

@0xbrayo
Copy link
Copy Markdown
Member

@0xbrayo 0xbrayo commented May 23, 2026

No description provided.

TimeToBuildBob and others added 5 commits May 22, 2026 18:16
Fork PRs cannot access repository secrets (KEY_FASTLANE_API,
KEY_ANDROID_JKS), which caused get-versionCode to always fail on
external contributions.

Fix:
- Add `if` conditions to Ruby/fastlane/age/update_version steps so they
  only run on the main repo or tag/push triggers.
- Move `Output versionCode` to always run, reading directly from
  build.gradle as a fallback when fastlane is skipped.
- Skip build-apk entirely on fork PRs since signing keys are unavailable.

Result: fork PRs now pass build-rust, test, and test-e2e without
hitting the secrets wall. The versionCode/APK lane is silently skipped
rather than failing loudly with credential errors.

Addresses: ActivityWatch#139 (comment)
aw-server-rust@dc70318 uses a version of the `time` crate that fails to
compile on Rust 1.80+ due to tightened type inference (E0282: type
annotations needed for Box<_>). Pin to 1.79.0 until aw-server-rust
updates its dependencies.
@0xbrayo 0xbrayo force-pushed the bob/ci-fork-pr-support branch from a0e1ac6 to 9a32352 Compare May 23, 2026 09:48
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 23, 2026

Greptile Summary

This PR enables CI to run on fork PRs by guarding all secret-dependent steps and jobs with if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository, and upgrades a wide range of GitHub Actions to their latest major versions. It also pins the Rust toolchain to 1.79.0 to work around a time crate compilation failure on 1.80+, bumps the aw-server-rust submodule, and refactors the Android emulator setup to use dynamic tool discovery instead of hard-coded $ANDROID_HOME/tools/bin/ paths.

  • Fork PR support: The get-versionCode job now gracefully falls back to reading the committed build.gradle value when fastlane secrets are unavailable; the build (apk/aab) job is skipped entirely on fork PRs via a job-level condition.
  • Action upgrades: All actions/checkout, actions/cache, actions/upload-artifact, actions/download-artifact, actions/setup-java, android-actions/setup-android, nowsprinting/check-version-format-action, and softprops/action-gh-release are bumped to current major versions; setup-java also gains the required distribution: temurin field.
  • Emulator refactor: A find_android_tool shell helper replaces hard-coded $ANDROID_HOME/tools/bin/ paths, and the macOS-only screencapture calls are now guarded with command -v checks so the step works on non-macOS runners.

Confidence Score: 4/5

Safe to merge; changes are confined to CI configuration with no production code impact.

The Rust toolchain comment references the old submodule commit (dc70318) while the submodule is simultaneously updated to 89b8cec. This creates ambiguity about whether the pin is still necessary or should be removed, which could cause confusion when the pin is eventually revisited. All other changes — action upgrades, fork PR guards, emulator tool discovery — look correct and well-structured.

.github/workflows/build.yml around the dtolnay/rust-toolchain@1.79.0 step — the stale commit hash in the comment should be reconciled with the new submodule pointer in aw-server-rust.

Important Files Changed

Filename Overview
.github/workflows/build.yml Adds fork PR support via if conditions on secret-dependent steps/jobs; upgrades all action versions (checkout, cache, setup-java, upload-artifact, etc.); pins Rust to 1.79.0 with a stale commit hash in the comment; refactors emulator tool discovery; guards macOS-only screencapture calls
aw-server-rust Submodule bumped from dc70318 to 89b8cec; the Rust 1.79.0 toolchain pin comment in build.yml references the old hash dc70318 but no longer matches the new pointer

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    trigger([Push / PR]) --> buildRust[build-rust\nRust 1.79.0 pinned\nBuilds jniLibs cache]
    trigger --> getVersion[get-versionCode]

    getVersion --> forkCheck{Fork PR?}
    forkCheck -- No --> fastlane[Run fastlane\nupdate_version]
    forkCheck -- Yes --> skipFastlane[Skip fastlane steps\nno secrets available]
    fastlane --> readGradle[Output versionCode\nfrom build.gradle]
    skipFastlane --> readGradle

    buildRust --> test[test\nrestore jniLibs cache]
    buildRust --> testE2E[test-e2e\nAndroid emulator]
    buildRust --> buildJob

    getVersion --> buildJob{Fork PR?}
    buildJob -- Yes --> skipBuild([Skip build job\nno signing secrets])
    buildJob -- No --> buildAPK[Build APK + AAB\nsign & upload artifacts]

    buildAPK --> publishGP[publish-google-play\ntag runs only]
    buildAPK --> githubRelease[GitHub Release\ntag runs only]
Loading

Reviews (1): Last reviewed commit: "temp: warm populate the cache" | Re-trigger Greptile

Comment on lines +57 to +58
# Pin to 1.79.0: aw-server-rust@dc70318 uses `time` crate which fails to compile
# on Rust 1.80+ due to tightened type inference (E0282 in Box<_> expressions).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Stale commit hash in Rust pin comment

The comment says the pin is needed because aw-server-rust@dc70318 fails on Rust 1.80+, but this PR simultaneously bumps the submodule pointer from dc70318 to 89b8cec. If the new submodule commit has resolved the time crate compilation issue, the toolchain should be unpinned and the comment removed. If the issue persists in 89b8cec, the comment should reference that commit hash instead.

@0xbrayo 0xbrayo closed this May 23, 2026
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.

2 participants