Skip to content

Commit 5fd3952

Browse files
fix: stop warning for missing PR on target (#115)
1 parent 258cd43 commit 5fd3952

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

dist/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15714,15 +15714,13 @@ async function main () {
1571415714
try {
1571515715
const payloadRaw = await readFile(GITHUB_EVENT_PATH, 'utf8');
1571615716
const payload = JSON.parse(payloadRaw);
15717-
if (payload && payload.pull_request && payload.pull_request.head) {
15717+
if (payload?.pull_request?.head) {
1571815718
const repo = payload.pull_request.head.repo.full_name;
1571915719
core.info(`rewrite repo to ${repo}`);
1572015720
config.urlRewriteExpressions.push({
1572115721
pattern: new RegExp(`github.com/${GITHUB_REPOSITORY}(/.*/)(${GITHUB_BASE_REF})/(.*)`),
1572215722
replacement: `github.com/${repo}$1${GITHUB_HEAD_REF}/$3`
1572315723
});
15724-
} else {
15725-
core.warning('unexpected payload structure', payload);
1572615724
}
1572715725
} catch (err) {
1572815726
core.warning(err);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ async function main () {
5656
try {
5757
const payloadRaw = await readFile(GITHUB_EVENT_PATH, 'utf8');
5858
const payload = JSON.parse(payloadRaw);
59-
if (payload && payload.pull_request && payload.pull_request.head) {
59+
if (payload?.pull_request?.head) {
6060
const repo = payload.pull_request.head.repo.full_name;
6161
core.info(`rewrite repo to ${repo}`);
6262
config.urlRewriteExpressions.push({
6363
pattern: new RegExp(`github.com/${GITHUB_REPOSITORY}(/.*/)(${GITHUB_BASE_REF})/(.*)`),
6464
replacement: `github.com/${repo}$1${GITHUB_HEAD_REF}/$3`
6565
});
66-
} else {
67-
core.warning('unexpected payload structure', payload);
6866
}
6967
} catch (err) {
7068
core.warning(err);

0 commit comments

Comments
 (0)