mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 10:54:56 +02:00
77 lines
3.0 KiB
YAML
77 lines
3.0 KiB
YAML
name: Backend diagnostics (comment)
|
|
|
|
on:
|
|
workflow_run:
|
|
types: [completed]
|
|
workflows:
|
|
- Backend diagnostics (inspect) # backend-diagnostics.inspect.yml
|
|
|
|
jobs:
|
|
compare-memory:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6.0.3
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: memory-artifact-*
|
|
path: artifacts
|
|
merge-multiple: true
|
|
github-token: ${{ github.token }}
|
|
repository: ${{ github.repository }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
- name: Check artifacts
|
|
run: ls -lh artifacts/
|
|
- name: Load PR Number
|
|
id: load-pr-num
|
|
run: echo "pr-number=$(cat artifacts/pr_number)" >> "$GITHUB_OUTPUT"
|
|
- name: Find heap snapshot artifacts
|
|
id: find-heap-snapshot-artifacts
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
const { owner, repo } = context.repo;
|
|
const run_id = context.payload.workflow_run.id;
|
|
const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {
|
|
owner,
|
|
repo,
|
|
run_id,
|
|
});
|
|
const artifactNames = {
|
|
base: 'base-heap-snapshot.heapsnapshot',
|
|
head: 'head-heap-snapshot.heapsnapshot',
|
|
};
|
|
for (const [label, artifactName] of Object.entries(artifactNames)) {
|
|
const artifact = artifacts.find(artifact => artifact.name === artifactName);
|
|
if (artifact == null) throw new Error(`Artifact not found: ${artifactName}`);
|
|
core.setOutput(`${label}-url`, `https://github.com/${owner}/${repo}/actions/runs/${run_id}/artifacts/${artifact.id}`);
|
|
}
|
|
|
|
- id: build-comment
|
|
name: Build memory comment
|
|
env:
|
|
MK_MEMORY_HEAP_SNAPSHOT_ARTIFACT_URL_BASE: ${{ steps.find-heap-snapshot-artifacts.outputs.base-url }}
|
|
MK_MEMORY_HEAP_SNAPSHOT_ARTIFACT_URL_HEAD: ${{ steps.find-heap-snapshot-artifacts.outputs.head-url }}
|
|
run: node .github/scripts/backend-diagnostics.render-md.mts ./artifacts/memory-base.json ./artifacts/memory-head.json ./output.md
|
|
- uses: thollander/actions-comment-pull-request@v3
|
|
with:
|
|
pr-number: ${{ steps.load-pr-num.outputs.pr-number }}
|
|
comment-tag: show_memory_diff
|
|
file-path: ./output.md
|
|
- name: Tell error to PR
|
|
uses: thollander/actions-comment-pull-request@v3
|
|
if: failure() && steps.load-pr-num.outputs.pr-number
|
|
with:
|
|
pr-number: ${{ steps.load-pr-num.outputs.pr-number }}
|
|
comment-tag: show_memory_diff_error
|
|
message: |
|
|
An error occurred while comparing backend memory usage. See [workflow logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
|