Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.5 KiB
YAML
Raw Normal View History

2024-10-06 19:17:20 +02:00
name: Post Sticky Comment
description: Post a sticky comment
inputs:
2024-10-06 20:51:21 +02:00
marker:
description: Unique marker
2024-10-06 19:17:20 +02:00
required: true
type: string
body:
description: Body
required: true
type: string
pr:
description: Pull Request Number
required: true
type: string
runs:
using: composite
steps:
- name: Create metadata
uses: actions/github-script@v7
2024-10-06 20:51:21 +02:00
env:
BODY: ${{ inputs.body }}
2024-10-06 19:17:20 +02:00
with:
script: |
const fs = require('fs');
try {
// Get inputs from the GitHub Action
2024-10-06 20:51:21 +02:00
const marker = "${{ inputs.marker }}";
const body = process.env.BODY; // Transfer input via env variable as it's not possible to access it directly https://github.com/actions/github-script/issues/56#issuecomment-642188313
2024-10-06 19:17:20 +02:00
const pr = ${{ inputs.pr }};
// Create the content of the JSON file
const content = JSON.stringify({
2024-10-06 20:51:21 +02:00
marker: marker,
2024-10-06 19:17:20 +02:00
body: body,
pr_number: pr
}, null, 2);
console.debug(content)
fs.writeFileSync('comment-${{ github.job }}.json', content);
console.log('comment.json file has been written successfully.');
} catch (error) {
core.setFailed(`Action failed with error: ${error}`);
}
- name: 📤 Upload data
uses: actions/upload-artifact@v4
with:
name: comment_artifacts-${{ github.job }}
path: |
comment-${{ github.job }}.json