Skip to content

Commit 8d3bb50

Browse files
use defaults to retrieve the github token and sha
1 parent b4cdaa6 commit 8d3bb50

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Additionally, `title` and `body` outputs are available as well to get the respec
1919
# Find the PR associated with this push, if there is one.
2020
- uses: jwalton/gh-find-current-pr@v1
2121
id: findPr
22-
with:
23-
github-token: ${{ secrets.GITHUB_TOKEN }}
2422
# This will echo "Your PR is 7", or be skipped if there is no current PR.
2523
- run: echo "Your PR is ${PR}"
2624
if: success() && steps.findPr.outputs.number

action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ author: jwalton
33
description: Find a PR associated with the current commit.
44
inputs:
55
github-token:
6-
description: The GitHub token used to create an authenticated client.
6+
description: The GitHub token used to create an authenticated client. Defaults to github provided token.
7+
default: ${{ github.token }}
78
sha:
89
description: Sha to get PR for. Defaults to current sha.
9-
required: false
10+
default: ${{ github.sha }}
1011
outputs:
1112
pr:
1213
description: The PR if one was found. (e.g. '345' for #345) [Deprecated: Please use number instead]

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const { GitHub, context } = require('@actions/github');
33

44
async function main() {
55
const token = core.getInput('github-token', { required: true });
6-
const sha = core.getInput('sha');
6+
const sha = core.getInput('sha', { required: true});
77

88
const client = new GitHub(token, {});
99
const result = await client.repos.listPullRequestsAssociatedWithCommit({
1010
owner: context.repo.owner,
1111
repo: context.repo.repo,
12-
commit_sha: sha || context.sha,
12+
commit_sha: sha,
1313
});
1414

1515
const pr = result.data.length > 0 && result.data[0];

0 commit comments

Comments
 (0)