-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
156 additions
and
47 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,52 @@ | ||
name: Post Sticky Comment | ||
description: Post a sticky comment | ||
inputs: | ||
title: | ||
description: Unique title | ||
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 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
try { | ||
// Get inputs from the GitHub Action | ||
const title = JSON.parse(`"${{ inputs.title }}"`); // Safely parsing as a string | ||
const body = JSON.parse(`"${{ inputs.body }}"`); // Safely parsing as a string | ||
const pr = ${{ inputs.pr }}; | ||
// Create the content of the JSON file | ||
const content = JSON.stringify({ | ||
title: title, | ||
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 |
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