File tree Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Original file line number Diff line number Diff line change 3
3
workflow_dispatch :
4
4
inputs :
5
5
pr_number :
6
- type : number
6
+ type : string
7
7
description : " Run workflow for this PR number"
8
8
required : true
9
9
project_id :
10
- type : number
10
+ type : string
11
11
description : " Github Project Number"
12
12
required : true
13
- default : 16
13
+ default : " 16 "
14
14
pull_request :
15
15
types :
16
16
- opened
17
17
18
+ env :
19
+ GH_TOKEN : ${{ github.token }}
20
+
18
21
jobs :
22
+ get-pr-repo :
23
+ runs-on : ubuntu-latest
24
+ outputs :
25
+ pr_repo_name : ${{ steps.get-repo-name.outputs.repo_name || github.event.pull_request.head.repo.full_name }}
26
+
27
+ # INFO `github.event.pull_request.head.repo.full_name` is not available on manual triggered (dispatched) runs
28
+ steps :
29
+ - name : Get PR repo name
30
+ if : ${{ github.event_name == 'workflow_dispatch' }}
31
+ id : get-repo-name
32
+ run : |
33
+ repo_name=$(gh pr view ${{ inputs.pr_number }} --json headRepository,headRepositoryOwner --repo ${{ github.repository }} | jq -r '.headRepositoryOwner.login + "/" + .headRepository.name')
34
+ echo "repo_name=$repo_name" >> $GITHUB_OUTPUT
35
+
19
36
auto-assign-pr :
20
- if : ${{ github.event.pull_request.head.repo.full_name == github.repository }}
37
+ needs :
38
+ - get-pr-repo
39
+ if : ${{ needs.get-pr-repo.outputs.pr_repo_name == github.repository }}
21
40
uses : ynput/ops-repo-automation/.github/workflows/pr_to_project.yml@main
22
41
with :
23
42
repo : " ${{ github.repository }}"
24
- project_id : " ${{ inputs.project_id }} "
25
- pull_request_number : " ${{ github.event.pull_request.number || inputs.pr_number }}"
43
+ project_id : ${{ inputs.project_id != '' && fromJSON(inputs.project_id) || 16 }}
44
+ pull_request_number : ${{ github.event.pull_request.number || fromJSON( inputs.pr_number) }}
26
45
secrets :
27
- token : ${{ secrets.YNPUT_BOT_TOKEN }}
46
+ # INFO fallback to default `github.token` is required for PRs from forks
47
+ # INFO organization secrets won't be available to forks
48
+ token : ${{ secrets.YNPUT_BOT_TOKEN || github.token}}
You can’t perform that action at this time.
0 commit comments