mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
---
|
|
name: Post Comment for Size Comparison
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Size Comparison"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
post-size-cmp:
|
|
name: Post Comment on Pull Request
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- if: github.event.workflow_run.event == 'pull_request'
|
|
name: Download Artifact (master)
|
|
uses: Legit-Labs/action-download-artifact@v2
|
|
with:
|
|
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
workflow: size-cmp.yml
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
name: size-cmp-master-info
|
|
path: "size-cmp-master-info/"
|
|
|
|
- if: github.event.workflow_run.event == 'pull_request'
|
|
name: Download Artifact (PR)
|
|
uses: Legit-Labs/action-download-artifact@v2
|
|
with:
|
|
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
workflow: size-cmp.yml
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
name: size-cmp-pr-info
|
|
path: "size-cmp-pr-info/"
|
|
|
|
- name: Make pull request comment
|
|
run: python3 ci/make_example_size_cmt.py
|
|
|
|
- name: Post Comment
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
const commentInfo = {
|
|
...context.repo,
|
|
issue_number: ${{ env.PR_NUMBER }},
|
|
};
|
|
|
|
const comment = {
|
|
...commentInfo,
|
|
body: JSON.parse(process.env.YEW_EXAMPLE_SIZES),
|
|
};
|
|
|
|
function isCommentByBot(comment) {
|
|
return comment.user.type === "Bot" && comment.body.includes("### Size Comparison");
|
|
}
|
|
|
|
let commentId = null;
|
|
const comments = (await github.rest.issues.listComments(commentInfo)).data;
|
|
for (let i = comments.length; i--; ) {
|
|
const c = comments[i];
|
|
if (isCommentByBot(c)) {
|
|
commentId = c.id;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (commentId) {
|
|
try {
|
|
await github.rest.issues.updateComment({
|
|
...context.repo,
|
|
comment_id: commentId,
|
|
body: comment.body,
|
|
});
|
|
} catch (e) {
|
|
commentId = null;
|
|
}
|
|
}
|
|
|
|
if (!commentId) {
|
|
await github.rest.issues.createComment(comment);
|
|
}
|