Closed viceice closed 5 days ago
Added breaking tag, let's do it for v38
Is it necessary to do it via token
or can we just enabled it when platform is GIthubApp?
When we perform initPlatform we use the token to check whether the platform is a GithubApp and store this information locally in the platformConfig object using isGhApp
boolean field. We can reuse this value.
So will the worker keep platformCommit=auto for the whole run? Where would the logic lie?
We only use this option for Github so we can keep the logic in platform/github/scm
, so that might not be an issue even if it's not ideal.
To
export class GithubScm extends DefaultGitScm {
override commitAndPush(
commitConfig: CommitFilesConfig,
): Promise<LongCommitSha | null> {
let platformCommit = commitConfig.platformCommit;
if (platformCommit === 'auto' && isGHApp()) {
platformCommit = 'enabled';
}
return commitConfig.platformCommit === 'enabled'
? commitFiles(commitConfig)
: git.commitFiles(commitConfig);
}
}
The isGhApp
fn will reside in platform/github/index
export function isGHApp(): boolean {
return !!platformConfig.isGHApp;
}
We can also move this logic to the renovateRepository
fn.
Around here:
https://github.com/renovatebot/renovate/blob/f8f518493dad03c26facac4f110b4e553b09b99e/lib/workers/repository/index.ts#L75-L78
This way platformCommit
stays changed.
Keeping the logic in platform sounds better
Describe the proposed change(s).
Change
platformCommit
to enum like with valuesenabled
,auto
anddisabled
. Default toauto
. Set toenabled
when it's auto and we detect an github app token. i think they start withghs_
.https://github.com/renovatebot/renovate/blob/66de0465e944f55669d5822cea6a2d459a6e5ed6/lib/util/check-token.ts#L67-L69