14
14
if : |
15
15
github.repository == 'apollographql/apollo-client-nextjs' &&
16
16
(
17
- github.event_name == 'workflow_dispatch' ||
17
+ github.event_name == 'workflow_dispatch' ||
18
18
(
19
19
github.event.issue.pull_request &&
20
20
(
@@ -33,14 +33,46 @@ jobs:
33
33
if : github.event_name == 'issue_comment'
34
34
id : comment-branch
35
35
36
+ - name : Get sha
37
+ if : github.event_name == 'issue_comment'
38
+ id : parse-sha
39
+ continue-on-error : true
40
+ run : |
41
+ if [ "${{ steps.comment-branch.outputs.head_owner }}" == "apollographql" ]; then
42
+ echo "sha=${{ steps.comment-branch.outputs.head_sha }}" >> "${GITHUB_OUTPUT}"
43
+ else
44
+ sha_from_comment="$(echo $COMMENT_BODY | tr -s ' ' | cut -d ' ' -f2)"
45
+
46
+ if [ $sha_from_comment == "/release:pr" ]; then
47
+ exit 1
48
+ else
49
+ echo "sha=$sha_from_comment" >> "${GITHUB_OUTPUT}"
50
+ fi
51
+ fi
52
+ env :
53
+ COMMENT_BODY : ${{ github.event.comment.body }}
54
+
55
+ - name : Comment sha reminder
56
+ if : steps.parse-sha.outcome == 'failure'
57
+ uses :
peter-evans/[email protected]
58
+ with :
59
+ issue-number : ${{ github.event.issue.number }}
60
+ body : |
61
+ Did you forget to add the sha? Please use `/release:pr <sha>`
62
+
63
+ - name : Fail job
64
+ if : steps.parse-sha.outcome == 'failure'
65
+ run : |
66
+ exit 1
67
+
36
68
- name : Checkout head ref (comment trigger)
37
69
if : github.event_name == 'issue_comment'
38
70
uses : actions/checkout@v4
39
71
with :
40
72
# # specify the owner + repository in order to checkout the fork
41
73
# # for community PRs
42
74
repository : ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}
43
- ref : ${{ steps.comment-branch .outputs.head_ref }}
75
+ ref : ${{ steps.parse-sha .outputs.sha }}
44
76
fetch-depth : 0
45
77
46
78
- name : Checkout head ref (dispatch trigger)
0 commit comments