Class Settings
java.lang.Object
com.example.adkstale.Settings
Configuration read from environment variables. Mirrors
settings.py in the Python ADK
stale issue auditor.
Values are exposed as accessor methods (read lazily on each call) rather than
static final fields. This keeps the class loadable in unit tests and agent loaders without a
GITHUB_TOKEN present — only githubToken() throws when the token is
actually required (i.e. right before a network call).
Required variables:
GITHUB_TOKEN— GitHub Personal Access Token (or the workflow's built-in token) withissues:write. Required for both interactive and workflow modes.GOOGLE_API_KEY— Gemini API key. Required for both modes (or set up Vertex AI credentials andGOOGLE_GENAI_USE_VERTEXAI=TRUE).
Optional variables (defaults match the Python sample unless noted):
OWNER/REPO— default togoogle/adk-java.MODEL— Gemini model used for reasoning. Defaults togemini-flash-latest; this is a high-volume, low-complexity classification task for which a Flash model is the right cost/latency trade-off (the Python sample usesgemini-2.5-flash). Overridable without a code change.INTERACTIVE—1/truefor interactive mode (asks for confirmation before mutating issues),0/falsefor unattended workflow mode. Defaults to interactive when unset.DRY_RUN—1/trueto log intended comments/labels/closures without calling the GitHub mutation endpoints. Defaults to off.EVENT_NAME— the GitHub event that triggered the workflow (schedule,workflow_dispatch,issues, ...). Drives single-issue vs. batch behavior.ISSUE_NUMBER— populated by GitHub Actions for issue events; audits that one issue.ISSUE_COUNT_TO_PROCESS— max number of stale-candidate issues to audit per batch run. Defaults to20.STALE_LABEL— the label that marks an issue as stale. Defaults tostale. This label must exist in the repository.REQUEST_CLARIFICATION_LABEL— label applied alongsidestalewhen a maintainer asked for clarification. Defaults torequest clarification.MAINTAINERS— optional comma-separated list of GitHub handles to treat as maintainers. When set, it overrides the (push-access) collaborator lookup — useful when the token cannot list collaborators.STALE_HOURS_THRESHOLD— hours of inactivity after a maintainer question before an issue is marked stale. Defaults to168(7 days).CLOSE_HOURS_AFTER_STALE_THRESHOLD— hours an issue may remain stale before it is closed. Defaults to168(7 days).GRAPHQL_COMMENT_LIMIT/GRAPHQL_EDIT_LIMIT/GRAPHQL_TIMELINE_LIMIT— how many recent comments / body edits / timeline events to fetch per issue. Default to30/10/20.SLEEP_BETWEEN_ISSUES_MS— pause between issues in a batch run to respect rate limits. Defaults to1500.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleHours an issue may stay marked stale before it is closed.static @Nullable Stringstatic StringReturns the GitHub token, throwing a clear error if it is not configured.static intstatic intstatic intstatic booleanReturns true if aGITHUB_TOKENis configured, without throwing.static booleanisDryRun()static booleanstatic @Nullable Stringstatic @Nullable Stringstatic @Nullable Stringstatic Stringmodel()Returns the Gemini model used for reasoning.static Stringowner()static intparseNumberString(@Nullable String value, int defaultValue) Parses a number from a string, falling back todefaultValueon null/blank/invalid input.static Stringrepo()static Stringstatic longstatic doubleHours of inactivity after a maintainer question before an issue is marked stale.static String
-
Method Details
-
githubToken
Returns the GitHub token, throwing a clear error if it is not configured. -
hasGithubToken
public static boolean hasGithubToken()Returns true if aGITHUB_TOKENis configured, without throwing. -
owner
-
repo
-
model
Returns the Gemini model used for reasoning. Defaults togemini-flash-latest(a Flash model suits this high-volume, low-complexity decision task) and is overridable via theMODELenvironment variable. -
staleLabel
-
requestClarificationLabel
-
eventName
-
issueNumber
-
issueCountToProcess
-
maintainersOverride
-
isInteractive
public static boolean isInteractive() -
isDryRun
public static boolean isDryRun() -
staleHoursThreshold
public static double staleHoursThreshold()Hours of inactivity after a maintainer question before an issue is marked stale. -
closeHoursAfterStaleThreshold
public static double closeHoursAfterStaleThreshold()Hours an issue may stay marked stale before it is closed. -
graphqlCommentLimit
public static int graphqlCommentLimit() -
graphqlEditLimit
public static int graphqlEditLimit() -
graphqlTimelineLimit
public static int graphqlTimelineLimit() -
sleepBetweenIssuesMs
public static long sleepBetweenIssuesMs() -
parseNumberString
Parses a number from a string, falling back todefaultValueon null/blank/invalid input. Mirrorsparse_number_stringin the Python utils.
-