-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require sha in snapshot releases for forks (#292)
* Update snapshot release workflow to require sha in forks * Update .github/workflows/snapshot-release.yml Co-authored-by: Alessia Bellisario <[email protected]> --------- Co-authored-by: Lenz Weber-Tronic <[email protected]> Co-authored-by: Alessia Bellisario <[email protected]>
- Loading branch information
1 parent
0aca825
commit 52dc8eb
Showing
1 changed file
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
if: | | ||
github.repository == 'apollographql/apollo-client-nextjs' && | ||
( | ||
github.event_name == 'workflow_dispatch' || | ||
github.event_name == 'workflow_dispatch' || | ||
( | ||
github.event.issue.pull_request && | ||
( | ||
|
@@ -33,14 +33,46 @@ jobs: | |
if: github.event_name == 'issue_comment' | ||
id: comment-branch | ||
|
||
- name: Get sha | ||
if: github.event_name == 'issue_comment' | ||
id: parse-sha | ||
continue-on-error: true | ||
run: | | ||
if [ "${{ steps.comment-branch.outputs.head_owner }}" == "apollographql" ]; then | ||
echo "sha=${{ steps.comment-branch.outputs.head_sha }}" >> "${GITHUB_OUTPUT}" | ||
else | ||
sha_from_comment="$(echo $COMMENT_BODY | tr -s ' ' | cut -d ' ' -f2)" | ||
if [ $sha_from_comment == "/release:pr" ]; then | ||
exit 1 | ||
else | ||
echo "sha=$sha_from_comment" >> "${GITHUB_OUTPUT}" | ||
fi | ||
fi | ||
env: | ||
COMMENT_BODY: ${{ github.event.comment.body }} | ||
|
||
- name: Comment sha reminder | ||
if: steps.parse-sha.outcome == 'failure' | ||
uses: peter-evans/[email protected] | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
Did you forget to add the sha? Please use `/release:pr <sha>` | ||
- name: Fail job | ||
if: steps.parse-sha.outcome == 'failure' | ||
run: | | ||
exit 1 | ||
- name: Checkout head ref (comment trigger) | ||
if: github.event_name == 'issue_comment' | ||
uses: actions/checkout@v4 | ||
with: | ||
## specify the owner + repository in order to checkout the fork | ||
## for community PRs | ||
repository: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }} | ||
ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
ref: ${{ steps.parse-sha.outputs.sha }} | ||
fetch-depth: 0 | ||
|
||
- name: Checkout head ref (dispatch trigger) | ||
|