From ce2b6102b4a538dcb1825c756a8379a832c6a43d Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Tue, 17 Sep 2024 08:04:02 -0500 Subject: [PATCH] Use alternate `ref` default for PRs --- action.yaml | 1 + src/main.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index de85be4..78d8ae1 100644 --- a/action.yaml +++ b/action.yaml @@ -15,6 +15,7 @@ inputs: ref: description: "The reference can be a branch, tag, or a commit SHA" required: false + default: ${{ github.head_ref || github.ref }} repo: description: "Repo owner & name, slash separated, only set if invoking a workflow in a different repo" required: false diff --git a/src/main.ts b/src/main.ts index c78c4df..67c7693 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,7 +26,7 @@ async function run(): Promise { // Optional inputs, with defaults const token = core.getInput('token') - const ref = core.getInput('ref') || github.context.ref + const ref = core.getInput('ref') const [owner, repo] = core.getInput('repo') ? core.getInput('repo').split('/') : [github.context.repo.owner, github.context.repo.repo]