Configurable executable and env for CLI task#485
Merged
marandaneto merged 4 commits intoPostHog:mainfrom Apr 13, 2026
Merged
Conversation
Make tasks public so inputs/outputs can be configured in the end project
Member
|
thanks @brettwillis thats great |
marandaneto
reviewed
Apr 13, 2026
| id("com.posthog.android") // <- add this plugin | ||
| } | ||
|
|
||
| // Optional configuration |
Member
There was a problem hiding this comment.
it'd be cool to amend this section of the docs as well https://posthog.com/docs/error-tracking/upload-mappings/android#inject-and-upload
marandaneto
reviewed
Apr 13, 2026
| // Optional configuration | ||
| tasks.withType<PostHogCliExecTask> { | ||
| // Custom CLI location | ||
| // defaults to globally installed posthog-cli on the PATH |
Member
There was a problem hiding this comment.
you can just export the env variables as well
https://posthog.com/docs/error-tracking/upload-mappings/android#authenticate
you dont need to manually do posthog-cli login
Member
|
@brettwillis can you add a changset entry? https://github.com/PostHog/posthog-android/blob/main/RELEASING.md |
Member
@brettwillis you jsut need to run |
marandaneto
approved these changes
Apr 13, 2026
Member
marandaneto
left a comment
There was a problem hiding this comment.
left a few comments otherwise LGTM
5 tasks
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.
I've been trialling migrating to PostHog from Crashlytics, and I've hit that TODO in the plugin implementation where the CLI install location is not configurable, so I thought I'd help out if that's amenable?
💡 Motivation and Context
The upload mappings task relies on the machine having a globally installed
posthog-clithat is already authenticated. This PR adds input variables to thePostHogCliExecTaskforpostHogExecutable(defaults to"posthog-cli"as per existing global install behaviour)postHogHost(optional, setsPOSTHOG_CLI_HOSTenv variable)postHogProjectId(optional, setsPOSTHOG_CLI_PROJECT_IDenv variable)postHogApiKey(optional, setsPOSTHOG_CLI_API_KEYenv variable)Furthermore, all tasks are made public so that the inputs can be configured in the end project. Note: this exposes your task hierarchy as a de-facto public API, but otherwise it's impossible to actually set those input variables in the end project.
In this way, the PostHog CLI can be entirely standalone without relying on global machine state.
💚 How did you test it?
I ran
:posthog-android-gradle-plugin:build.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file