Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b10cc2d
Revert "include cross-package coverage in codecov"
galargh Dec 10, 2021
8d7b557
Merge pull request #245 from protocol/revert-210-codecov-cross-package
galargh Dec 10, 2021
af39fc8
Revert "Revert "include cross-package coverage in codecov""
galargh Dec 10, 2021
3d5f0d1
Merge pull request #246 from protocol/revert-245-revert-210-codecov-c…
galargh Dec 10, 2021
6f5cf40
Make automerge a reusable workflow (#260)
galargh Jan 7, 2022
3543681
Merge remote-tracking branch 'origin/master' into next
galargh Jan 11, 2022
0454bfc
check github actions yamls (#272)
galargh Jan 11, 2022
c9b7c51
use validate-yaml-schema action from mainline (#277)
galargh Jan 12, 2022
816b8a7
upgrade lewagon/wait-on-check-action to v1.1.1 (#278)
galargh Jan 13, 2022
1a2b29c
always add a version.json file if it doesn't exist (#281)
galargh Jan 14, 2022
97688fd
fix go-test runner string
galargh Jan 14, 2022
9d885d4
check if tag already exists in release-check (#287)
galargh Jan 28, 2022
a199227
allow specifying custom PATH for 386 arch (#289)
galargh Feb 1, 2022
1814d3c
use pull_request_target event for release-check workflow
galargh Feb 22, 2022
5f45689
add comment on missing version.json
galargh Mar 16, 2022
b08430a
Merge branch 'next' into pr-target-release-check
galargh Nov 14, 2022
1b67020
Merge branch 'next' into pr-target-release-check
galargh Jan 5, 2023
a4bdee8
Merge remote-tracking branch 'origin/next' into pr-target-release-check
galargh Jan 16, 2023
c1afd5f
chore: revert release checker path trigger change
galargh Jan 16, 2023
618d652
chore: add footnote when non-docs files are modified with the release
galargh Jan 16, 2023
87bda4f
Merge remote-tracking branch 'origin/next' into pr-target-release-check
galargh Feb 1, 2023
3a1f5dd
fix: prev version calculation
galargh Feb 1, 2023
7db61bc
fix: diff calculation in release-check
galargh Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 48 additions & 53 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# This workflow cannot post sticky comments on PRs from forked repositories.
# Instead, it outputs the message it would have posted as a workflow notice.
# See https://github.com/protocol/.github/issues/254 for details.

name: Release Checker
on: [ workflow_call ]

Expand All @@ -17,8 +13,16 @@ jobs:
go-version: "1.19.x"
- id: version
name: Determine version
if: hashFiles('version.json')
run: echo "version=$(jq -r .version version.json)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ github.token }}
HEAD_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# If `version.json` file doesn't exists, `version` is `""` and `404` is printed on stderr.
# The step won't be marked as a failure though because the error happens in a subshell.
version="$(gh api -X GET "repos/$HEAD_FULL_NAME/contents/version.json" -f ref="$HEAD_SHA" --jq '.content' | base64 -d | jq -r '.version')"
echo "version=$version"
echo "version=$version" >> $GITHUB_OUTPUT
- id: tag
name: Check if the tag already exists
# Check if a git tag for the version (as read from version.json) exists
Expand Down Expand Up @@ -63,7 +67,7 @@ jobs:
echo $v
exit $status
fi
echo "version=$v" >> $GITHUB_ENV
echo "version=$v" >> $GITHUB_OUTPUT
fi
- name: Post output
if: steps.tag.outputs.exists == 'false' && steps.prev.outputs.version == ''
Expand Down Expand Up @@ -114,63 +118,54 @@ jobs:
fi
printf "output<<$EOF\n%s\n$EOF" "$output" >> $GITHUB_OUTPUT
- id: footnote
if: github.base_ref != github.event.repository.default_branch
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
BASE_REF: ${{ github.base_ref }}
GITHUB_TOKEN: ${{ github.token }}
HEAD_LABEL: ${{ github.event.pull_request.head.label }}
run: |
echo 'output<<'"$EOF"'
---
output=''
if [[ "$DEFAULT_BRANCH" != "$BASE_REF" ]]; then
output+='
## Cutting a Release (when not on `'"$DEFAULT_BRANCH"'`)

This PR is targeting `'"$BASE_REF"'`, which is not the default branch.
If you wish to cut a release once this PR is merged, please add the `release` label to this PR.
'"$EOF" >> $GITHUB_ENV
- id: message
if: steps.tag.outputs.exists == 'false' && steps.prev.outputs.version != ''
env:
VERSION: ${{ steps.version.outputs.version }}
PREV_VERSION: ${{ steps.prev.outputs.version }}
BASE_HTML_URL: ${{ github.event.pull_request.base.repo.html_url }}
HEAD_LABEL: ${{ github.event.pull_request.head.label }}
GIT_DIFF: ${{ steps.git-diff.outputs.output }}
GORELEASE: ${{ steps.gorelease.outputs.output }}
GOCOMPAT: ${{ steps.gocompat.outputs.output }}
FOOTNOTE: ${{ steps.footnote.outputs.output }}
run: |
echo 'output<<'"$EOF"'
Suggested version: `'"$VERSION"'`
Comparing to: [`'"$PREV_VERSION"'`]('"$BASE_HTML_URL"'/releases/tag/'"$PREV_VERSION"') ([diff]('"$BASE_HTML_URL"'/compare/'"$PREV_VERSION"'..'"$HEAD_LABEL"'))

Changes in `go.mod` file(s):
```diff
'"$GIT_DIFF"'
```

`gorelease` says:
```
'"$GORELEASE"'
```
'
fi
diff="$(gh api -X GET "repos/$GITHUB_REPOSITORY/compare/$BASE_REF...$HEAD_LABEL" --jq '.files | map(.filename) | map(select(test("^(version\\.json|.*\\.md)$") | not)) | .[]')"
if [[ "$diff" != "" ]]; then
output+='
## Cutting a Release (and modifying non-markdown files)

`gocompat` says:
```
'"$GOCOMPAT"'
```
'"$FOOTNOTE"'
'"$EOF" >> $GITHUB_OUTPUT
This PR is modifying both `version.json` and non-markdown files.
The Release Checker is not able to analyse files that are not checked in to `'"$BASE_REF"'`. This might cause the above analysis to be inaccurate.
Please consider performing all the code changes in a separate PR before cutting the release.
'
fi
printf "output<<$EOF\n%s\n$EOF" "$output" >> $GITHUB_OUTPUT
- name: Post message on PR
uses: marocchino/sticky-pull-request-comment@82e7a0d3c51217201b3fedc4ddde6632e969a477 # v2.1.1
if: steps.tag.outputs.exists == 'false' && steps.prev.outputs.version != '' && github.event.pull_request.head.repo.full_name == github.repository
if: steps.tag.outputs.exists == 'false' && steps.prev.outputs.version != ''
with:
header: release-check
recreate: true
message: ${{ steps.message.outputs.output }}
- name: Set a notice message on run
if: steps.tag.outputs.exists == 'false' && steps.prev.outputs.version != '' && github.event.pull_request.head.repo.full_name != github.repository
env:
MESSAGE: ${{ steps.message.outputs.output }}
run: |
message="${MESSAGE//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
echo "::notice ::$message"
message: |
Suggested version: `${{ steps.version.outputs.version }}`
Comparing to: [${{ steps.prev.outputs.version }}](${{ github.event.pull_request.base.repo.html_url }}/releases/tag/${{ steps.prev.outputs.version }}) ([diff](${{ github.event.pull_request.base.repo.html_url }}/compare/${{ steps.prev.outputs.version }}..${{ github.event.pull_request.head.label }}))

Changes in `go.mod` file(s):
```diff
${{ steps.git-diff.outputs.output }}
```

`gorelease` says:
```
${{ steps.gorelease.outputs.output }}
```

`gocompat` says:
```
${{ steps.gocompat.outputs.output }}
```
${{ steps.footnote.outputs.output }}
2 changes: 1 addition & 1 deletion templates/.github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release Checker
on:
pull_request:
pull_request_target:
paths: [ 'version.json' ]

jobs:
Expand Down