Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
|
||||
// 讀取 input:node action 會把每個 input 轉成 INPUT_<NAME> 環境變數
|
||||
// (名稱大寫、空白換成底線)。action.yml 有設 default 時,runner 會先帶入 default。
|
||||
const message = process.env.INPUT_MESSAGE ?? 'Hello, World!';
|
||||
|
||||
// 設定 output:把 name=value 附加寫進 $GITHUB_OUTPUT 指向的檔案。
|
||||
// node action 的 output 不像 composite 需要在 action.yml 宣告 value。
|
||||
const githubOutput = process.env.GITHUB_OUTPUT;
|
||||
if (githubOutput) {
|
||||
fs.appendFileSync(githubOutput, `message=${message}${os.EOL}`);
|
||||
}
|
||||
|
||||
// 一般日誌輸出。若要讓 step 失敗,改用非零結束碼:process.exit(1)。
|
||||
console.log(`message=${message}`);
|
||||
Reference in New Issue
Block a user