mirror of
https://github.com/electron/electron.git
synced 2026-01-07 22:54:25 -05:00
use pr head ref
This commit is contained in:
@@ -41,7 +41,7 @@ function getCurrentCommitSha () {
|
||||
}
|
||||
|
||||
function getCurrentBranch () {
|
||||
return process.env.GITHUB_REF;
|
||||
return process.env.GITHUB_HEAD_REF;
|
||||
}
|
||||
|
||||
async function main () {
|
||||
@@ -49,6 +49,12 @@ async function main () {
|
||||
throw new Error('PATCH_UP_APP_CREDS environment variable not set');
|
||||
}
|
||||
|
||||
const currentBranch = getCurrentBranch();
|
||||
|
||||
if (!currentBranch) {
|
||||
throw new Error('GITHUB_HEAD_REF environment variable not set. Patch Up only works in PR workflows currently.');
|
||||
}
|
||||
|
||||
const octokit = new Octokit({
|
||||
...await getAuthOptionsForRepo({
|
||||
name: REPO_OWNER,
|
||||
@@ -60,7 +66,6 @@ async function main () {
|
||||
|
||||
// Get current git state
|
||||
const currentCommitSha = getCurrentCommitSha();
|
||||
const currentBranch = getCurrentBranch();
|
||||
|
||||
// Get the tree SHA from the current commit
|
||||
const currentCommit = await octokit.git.getCommit({
|
||||
|
||||
Reference in New Issue
Block a user