Skip to content

Commit cfb86c6

Browse files
author
Johannes Schneider
committed
refactor: only check whether PRs have been approved when performing the release
1 parent d8a913d commit cfb86c6

File tree

1 file changed

+3
-66
lines changed

1 file changed

+3
-66
lines changed

.github/workflows/perform-release.yml

+3-66
Original file line numberDiff line numberDiff line change
@@ -57,108 +57,45 @@ jobs:
5757

5858
- name: "Check Whether Code PR Can Be Merged"
5959
run: |
60-
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }}" --repo "${{ github.repository }}" --json number,reviewDecision,mergeable,statusCheckRollup)
60+
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.CODE_BRANCH_NAME }}" --repo "${{ github.repository }}" --json number,reviewDecision)
6161
NUMBER=$(echo "$PR" | jq -r '.number')
6262
DECISION=$(echo "$PR" | jq -r '.reviewDecision')
63-
MERGEABLE=$(echo "$PR" | jq -r '.mergeable')
64-
65-
if [[ "$MERGEABLE" != "MERGEABLE" ]]; then
66-
echo "Code PR (#$NUMBER) is not mergeable."
67-
exit 1
68-
fi
6963
7064
if [[ "$DECISION" != "APPROVED" ]]; then
7165
echo "Code PR (#$NUMBER) is not approved."
7266
exit 1
7367
fi
7468
75-
STATUS_CHECKS=$(echo "$PR" | jq -r '.statusCheckRollup')
76-
FAILED_CHECK_RUNS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "CheckRun" and .workflowName != "Perform Release" and .conclusion != "SUCCESS" and .conclusion != "NEUTRAL")')
77-
if [[ -n "$FAILED_CHECK_RUNS" ]]; then
78-
echo "Code PR (#$NUMBER) has failed check runs:"
79-
echo "$FAILED_CHECK_RUNS"
80-
exit 1
81-
fi
82-
83-
FAILED_STATUS_CONTEXTS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "StatusContext" and .state != "SUCCESS")')
84-
if [[ -n "$FAILED_STATUS_CONTEXTS" ]]; then
85-
echo "Code PR (#$NUMBER) has failed status contexts:"
86-
echo "$FAILED_STATUS_CONTEXTS"
87-
exit 1
88-
fi
89-
9069
echo "[DEBUG] Code PR (#$NUMBER) can be merged."
9170
env:
9271
GH_TOKEN: ${{ github.token }}
9372

9473
- name: "Check Whether Docs PR Can Be Merged"
9574
run: |
96-
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.DOCS_BRANCH_NAME }}" --repo ${{ env.DOCS_REPO }} --json number,reviewDecision,mergeable,statusCheckRollup)
75+
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.DOCS_BRANCH_NAME }}" --repo ${{ env.DOCS_REPO }} --json number,reviewDecision)
9776
NUMBER=$(echo "$PR" | jq -r '.number')
9877
DECISION=$(echo "$PR" | jq -r '.reviewDecision')
99-
MERGEABLE=$(echo "$PR" | jq -r '.mergeable')
100-
101-
if [[ "$MERGEABLE" != "MERGEABLE" ]]; then
102-
echo "Docs PR (#$NUMBER) is not mergeable."
103-
exit 1
104-
fi
10578
10679
if [[ "$DECISION" != "APPROVED" ]]; then
10780
echo "Docs PR (#$NUMBER) is not approved."
10881
exit 1
10982
fi
11083
111-
STATUS_CHECKS=$(echo "$PR" | jq -r '.statusCheckRollup')
112-
FAILED_CHECK_RUNS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "CheckRun" and .conclusion != "SUCCESS" and .conclusion != "NEUTRAL")')
113-
if [[ -n "$FAILED_CHECK_RUNS" ]]; then
114-
echo "Docs PR (#$NUMBER) has failed check runs:"
115-
echo "$FAILED_CHECK_RUNS"
116-
exit 1
117-
fi
118-
119-
FAILED_STATUS_CONTEXTS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "StatusContext" and .state != "SUCCESS")')
120-
if [[ -n "$FAILED_STATUS_CONTEXTS" ]]; then
121-
echo "Docs PR (#$NUMBER) has failed status contexts:"
122-
echo "$FAILED_STATUS_CONTEXTS"
123-
exit 1
124-
fi
125-
12684
echo "[DEBUG] Docs PR (#$NUMBER) can be merged."
12785
env:
12886
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}
12987

13088
- name: "Check Whether Release Notes PR Can Be Merged"
13189
run: |
132-
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }}" --repo ${{ env.DOCS_REPO }} --json number,reviewDecision,mergeable,statusCheckRollup)
90+
PR=$(gh pr view "${{ steps.determine-branch-names.outputs.RELEASE_NOTES_BRANCH_NAME }}" --repo ${{ env.DOCS_REPO }} --json number,reviewDecision)
13391
NUMBER=$(echo "$PR" | jq -r '.number')
13492
DECISION=$(echo "$PR" | jq -r '.reviewDecision')
135-
MERGEABLE=$(echo "$PR" | jq -r '.mergeable')
136-
137-
if [[ "$MERGEABLE" != "MERGEABLE" ]]; then
138-
echo "Release Notes PR (#$NUMBER) is not mergeable."
139-
exit 1
140-
fi
14193
14294
if [[ "$DECISION" != "APPROVED" ]]; then
14395
echo "Release Notes PR (#$NUMBER) is not approved."
14496
exit 1
14597
fi
14698
147-
STATUS_CHECKS=$(echo "$PR" | jq -r '.statusCheckRollup')
148-
FAILED_CHECK_RUNS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "CheckRun" and .conclusion != "SUCCESS" and .conclusion != "NEUTRAL")')
149-
if [[ -n "$FAILED_CHECK_RUNS" ]]; then
150-
echo "Release Notes PR (#$NUMBER) has failed check runs:"
151-
echo "$FAILED_CHECK_RUNS"
152-
exit 1
153-
fi
154-
155-
FAILED_STATUS_CONTEXTS=$(echo $STATUS_CHECKS | jq -r '.[] | select(.__typename == "StatusContext" and .state != "SUCCESS")')
156-
if [[ -n "$FAILED_STATUS_CONTEXTS" ]]; then
157-
echo "Release Notes PR (#$NUMBER) has failed status contexts:"
158-
echo "$FAILED_STATUS_CONTEXTS"
159-
exit 1
160-
fi
161-
16299
echo "[DEBUG] Release Notes PR (#$NUMBER) can be merged."
163100
env:
164101
GH_TOKEN: ${{ secrets.BOT_SDK_JS_FOR_DOCS_REPO_PR }}

0 commit comments

Comments
 (0)