Skip to content

add new base_ref output #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ As seen above, we have a single example step. Perhaps you would actually use a r
| `fork_full_name` | The full name of the fork in "org/repo" format |
| `sha` | The commit sha if being used in the context of a pull request |
| `ref` | The ref if being used in the context of a pull request |
| `base_ref` | The base ref that the pull request is merging into (if available and run in the context of a pull request) |

## Allowlist 👩‍🔬

Expand Down
4 changes: 4 additions & 0 deletions __tests__/schemas/action.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,7 @@ outputs:
description:
type: string
required: true
base_ref:
description:
type: string
required: true
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ outputs:
description: 'The commit sha if being used in the context of a pull request'
ref:
description: 'The ref if being used in the context of a pull request'
base_ref:
description: The base ref that the pull request is merging into (if available and run in the context of a pull request)
runs:
using: "node20"
main: "dist/index.js"
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/functions/prechecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export async function prechecks(
var sha = pr.data.head.sha
var ref = pr.data.head.ref

// set an output which is the branch name this PR is targeting to merge into
const baseRef = pr?.data?.base?.ref
core.setOutput('base_ref', baseRef)
core.debug(`base_ref: ${baseRef}`)

var forkBypass = false

// Determine whether to use the ref or sha depending on if the PR is from a fork or not
Expand Down