mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
ci: search for pull request when docs are deploying from a fork (#9858)
This commit is contained in:
parent
30e18aba69
commit
61051ba479
1 changed files with 11 additions and 1 deletions
12
.github/workflows/docs-deploy.yml
vendored
12
.github/workflows/docs-deploy.yml
vendored
|
@ -36,7 +36,17 @@ jobs:
|
||||||
shouldDeploy
|
shouldDeploy
|
||||||
};
|
};
|
||||||
} else if (eventType == "pull_request") {
|
} 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({
|
const {data: pr} = await github.rest.pulls.get({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|
Loading…
Add table
Reference in a new issue