-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into copy-app-chain
- Loading branch information
Showing
6 changed files
with
198 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Comment protobuf breaking action outcome on the pull request | ||
|
||
permissions: | ||
# for finding and downloading artifacts. | ||
actions: read | ||
# for commenting on pull requests. | ||
pull-requests: write | ||
# the content of the repo is irrelevant to this workflow. | ||
contents: none | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Protobuf"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
download-artifact-and-comment: | ||
runs-on: ubuntu-latest | ||
if: > | ||
github.event.workflow_run.conclusion == 'success' | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.find((artifact) => { | ||
return artifact.name == "result"; | ||
}); | ||
if (!matchArtifact) { | ||
var core = require('@actions/core'); | ||
core.setFailed('Artifact "result" not found.'); | ||
return; | ||
} | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/result.zip', Buffer.from(download.data)); | ||
- run: unzip result.zip -d result | ||
- name: Read PR number and outcome | ||
run: | | ||
pr_number=$(cat "result/pr_number.txt") | ||
outcome=$(cat "result/outcome.txt") | ||
echo "PR_NUMBER=${pr_number}" >> "$GITHUB_ENV" | ||
echo "OUTCOME=${outcome}" >> "$GITHUB_ENV" | ||
- name: Find comment | ||
id: find-comment | ||
uses: peter-evans/find-comment@v2 | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: buf breaking change | ||
- name: Comment status of break-check in the case of failure | ||
if: ${{ env.OUTCOME == 'failure' }} | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
body: | | ||
${{ github.sha }} (${{ github.event.workflow_run.updated_at }}) has a buf breaking change. | ||
View the workflow run: [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) | ||
edit-mode: append | ||
- name: Comment status of break-check in the case of success | ||
if: env.OUTCOME == 'success' && steps.find-comment.outputs.comment-id != '' | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
body: | | ||
${{ github.sha }} (${{ github.event.workflow_run.updated_at }}) has no buf breaking changes. | ||
View the workflow run: [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) | ||
edit-mode: append |
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
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# This workflow runs after test.yml and comments the test coverage on the pull request. | ||
name: Comment test coverage on the pull request | ||
|
||
permissions: | ||
# for finding and downloading artifacts. | ||
actions: read | ||
# for commenting on pull requests. | ||
pull-requests: write | ||
# the content of the repo is irrelevant to this workflow. | ||
contents: none | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Tests"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
download-artifact-and-comment: | ||
runs-on: ubuntu-latest | ||
if: > | ||
github.event.workflow_run.event == 'pull_request' && | ||
github.event.workflow_run.conclusion == 'success' | ||
steps: | ||
- name: Download artifact | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.find((artifact) => { | ||
return artifact.name == "result" | ||
}); | ||
if (!matchArtifact) { | ||
var core = require('@actions/core'); | ||
core.setFailed('Artifact "result" not found.'); | ||
return; | ||
} | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/result.zip', Buffer.from(download.data)); | ||
- run: unzip result.zip -d result | ||
- name: Read PR number and coverage | ||
run: | | ||
pr_number=$(cat "result/pr_number.txt") | ||
coverage=$(cat "result/coverage.txt") | ||
echo "PR_NUMBER=${pr_number}" >> "$GITHUB_ENV" | ||
echo "COVERAGE=${coverage}" >> "$GITHUB_ENV" | ||
- name: Find comment | ||
id: find-comment | ||
uses: peter-evans/find-comment@v2 | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Coverage as of | ||
- name: Comment coverage on PR | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
body: | | ||
Coverage as of ${{ github.sha }}: ${{ env.COVERAGE }}% | ||
edit-mode: append |
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
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ vendor/ | |
# Common test paths | ||
test/ | ||
tests/ | ||
testutil/ | ||
*_test.go | ||
*.pb.gw.go | ||
*.pb.go | ||
|
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