mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-29 05:13:01 -08:00
59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
# Copyright 2025 New Vector Ltd
|
|
# Copyright 2025-2026 Element Creations Ltd
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
name: dyff of rendered templates - comment
|
|
on:
|
|
workflow_run: # zizmor: ignore[dangerous-triggers] This is safe as not running any shell scripts, nor using any code from the upstream workflow
|
|
workflows: ["dyff of rendered templates"]
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
actions: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
manage-comment:
|
|
runs-on: ubuntu-latest
|
|
if: github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: Download dyff of templates
|
|
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
name: dyff-templates
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
|
|
# We cannot get the outputs from the worfklow run, so we have to download the artifact and parse the PR Number from there
|
|
- name: Load PR number
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
|
id: pr-number
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const prNumberOut = fs.readFileSync('pr-number.txt', 'utf8').trim();
|
|
const prNumber = Number(prNumberOut);
|
|
// Check if the conversion is valid and the number is a positive integer
|
|
if (isNaN(prNumber) || prNumber < 1 || !Number.isInteger(prNumber)) {
|
|
throw new Error(`Invalid PR number: ${prNumber}. Expected a positive integer.`);
|
|
}
|
|
core.setOutput('pr-number', prNumber);
|
|
|
|
- name: Find dyff comment
|
|
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
|
|
id: find-dyff-comment
|
|
with:
|
|
issue-number: ${{ steps.pr-number.outputs.pr-number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: 'dyff of changes in rendered templates'
|
|
|
|
- name: Create or update comment
|
|
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5
|
|
with:
|
|
comment-id: ${{ steps.find-dyff-comment.outputs.comment-id }}
|
|
issue-number: ${{ steps.pr-number.outputs.pr-number }}
|
|
body-path: dyff-output.md
|
|
edit-mode: replace
|