1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

ci: search for pull request when docs are deploying from a fork (#9858)

This commit is contained in:
Zack Pollard 2024-05-29 18:39:39 +01:00 committed by GitHub
parent 30e18aba69
commit 61051ba479
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,17 @@ jobs:
shouldDeploy
};
} else if (eventType == "pull_request") {
const pull_number = context.payload.workflow_run.pull_requests[0].number;
let pull_number = context.payload.workflow_run.pull_requests[0]?.number;
if(!pull_number) {
const response = await github.rest.search.issuesAndPullRequests({q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',per_page: 1,})
const items = response.data.items
if (items.length < 1) {
throw new Error("No pull request found for the commit")
}
const pullRequestNumber = items[0].number
console.info("Pull request number is", pullRequestNumber)
pull_number = pullRequestNumber
}
const {data: pr} = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,