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
8ae8dbbc2e
File diff suppressed because one or more lines are too long
@ -39,6 +39,13 @@ export default class Versioning {
|
|||||||
return process.env.GITHUB_REF;
|
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
|
* Regex to parse version description into separate fields
|
||||||
*/
|
*/
|
||||||
@ -162,8 +169,7 @@ export default class Versioning {
|
|||||||
* identifies the current commit.
|
* identifies the current commit.
|
||||||
*/
|
*/
|
||||||
static async getVersionDescription() {
|
static async getVersionDescription() {
|
||||||
const commitIsh = (await this.getTag()) ? 'HEAD' : `origin/${this.branch}`;
|
return this.git(['describe', '--long', '--tags', '--always', '--debug', this.sha]);
|
||||||
return this.git(['describe', '--long', '--tags', '--always', '--debug', commitIsh]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,11 +208,7 @@ export default class Versioning {
|
|||||||
* Note: HEAD should not be used, as it may be detached, resulting in an additional count.
|
* Note: HEAD should not be used, as it may be detached, resulting in an additional count.
|
||||||
*/
|
*/
|
||||||
static async getTotalNumberOfCommits() {
|
static async getTotalNumberOfCommits() {
|
||||||
const numberOfCommitsAsString = await this.git([
|
const numberOfCommitsAsString = await this.git(['rev-list', '--count', this.sha]);
|
||||||
'rev-list',
|
|
||||||
'--count',
|
|
||||||
`origin/${this.branch}`,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Number.parseInt(numberOfCommitsAsString, 10);
|
return Number.parseInt(numberOfCommitsAsString, 10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user