@@ -28,26 +28,29 @@ jobs:
28
28
PR_NUMBER : ${{ steps.pr_number.outputs.PR_NUMBER }}
29
29
PR_TITLE : ${{ steps.pr_number.outputs.PR_TITLE }}
30
30
PR_URL : ${{ steps.pr_number.outputs.PR_URL }}
31
+ PR_BRANCH : ${{ steps.pr_number.outputs.PR_BRANCH }}
31
32
COMMENT_ID : ${{ steps.comment_id.outputs.comment-id }}
32
33
CODER_BASE_IMAGE_TAG : ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
33
34
CODER_IMAGE_TAG : ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
34
35
35
36
runs-on : " ubuntu-latest"
36
37
steps :
37
- - name : Get PR number and title
38
+ - name : Get PR number, title, and branch name
38
39
id : pr_number
39
40
run : |
40
41
set -euxo pipefail
41
42
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
42
43
PR_NUMBER=${{ github.event.inputs.pr_number }}
43
- PR_TITLE=$(curl -sSL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER" | jq -r '.title')
44
+ PR_TITLE=$(gh pr view $PR_NUMBER --json title | jq -r '.title')
44
45
else
45
46
PR_NUMBER=${{ github.event.issue.number }}
46
47
PR_TITLE='${{ github.event.issue.title }}'
47
48
fi
49
+ PR_BRANCH=$(gh pr view $PR_NUMBER --json headRefName | jq -r '.headRefName')
48
50
echo "PR_URL=https://github.com/coder/coder/pull/$PR_NUMBER" >> $GITHUB_OUTPUT
49
51
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
50
52
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_OUTPUT
53
+ echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_OUTPUT
51
54
52
55
- name : Set required tags
53
56
id : set_tags
@@ -85,10 +88,12 @@ jobs:
85
88
DOCKER_CLI_EXPERIMENTAL : " enabled"
86
89
CODER_IMAGE_TAG : ${{ needs.pr_commented.outputs.coder_image_tag }}
87
90
PR_NUMBER : ${{ needs.pr_commented.outputs.pr_number }}
91
+ PR_BRANCH : ${{ needs.pr_commented.outputs.pr_branch }}
88
92
steps :
89
93
- name : Checkout
90
94
uses : actions/checkout@v3
91
95
with :
96
+ ref : ${{ env.PR_BRANCH }}
92
97
fetch-depth : 0
93
98
94
99
- name : Setup Node
0 commit comments