mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Fix fork PR builds
Remove hardcoded reference to the `origin` remote and instead implictly use the current commit or ref
This commit is contained in:
parent
229b0d02f8
commit
1245bfefc8
File diff suppressed because one or more lines are too long
@ -39,6 +39,13 @@ export default class Versioning {
|
||||
return process.env.GITHUB_REF;
|
||||
}
|
||||
|
||||
/**
|
||||
* The commit SHA that triggered the workflow run.
|
||||
*/
|
||||
static get sha() {
|
||||
return process.env.GITHUB_SHA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regex to parse version description into separate fields
|
||||
*/
|
||||
@ -162,8 +169,7 @@ export default class Versioning {
|
||||
* identifies the current commit.
|
||||
*/
|
||||
static async getVersionDescription() {
|
||||
const commitIsh = (await this.getTag()) ? 'HEAD' : `origin/${this.branch}`;
|
||||
return this.git(['describe', '--long', '--tags', '--always', '--debug', commitIsh]);
|
||||
return this.git(['describe', '--long', '--tags', '--always', '--debug', this.sha]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,11 +208,7 @@ export default class Versioning {
|
||||
* Note: HEAD should not be used, as it may be detached, resulting in an additional count.
|
||||
*/
|
||||
static async getTotalNumberOfCommits() {
|
||||
const numberOfCommitsAsString = await this.git([
|
||||
'rev-list',
|
||||
'--count',
|
||||
`origin/${this.branch}`,
|
||||
]);
|
||||
const numberOfCommitsAsString = await this.git(['rev-list', '--count', this.sha]);
|
||||
|
||||
return Number.parseInt(numberOfCommitsAsString, 10);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user