(thisArg, _arguments, P, generator)
| 19954 | step((generator = generator.apply(thisArg, _arguments || [])).next()); |
| 19955 | }); |
| 19956 | }; |
| 19957 | var { access, appendFile, writeFile } = import_fs.promises; |
| 19958 | var SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY"; |
| 19959 | var Summary = class { |
| 19960 | constructor() { |
| 19961 | this._buffer = ""; |
| 19962 | } |
| 19963 | /** |
| 19964 | * Finds the summary file path from the environment, rejects if env var is not found or file does not exist |
| 19965 | * Also checks r/w permissions. |
| 19966 | * |
| 19967 | * @returns step summary file path |
| 19968 | */ |
| 19969 | filePath() { |
| 19970 | return __awaiter(this, void 0, void 0, function* () { |
| 19971 | if (this._filePath) { |
| 19972 | return this._filePath; |
| 19973 | } |
| 19974 | const pathFromEnv = process.env[SUMMARY_ENV_VAR]; |
| 19975 | if (!pathFromEnv) { |
| 19976 | throw new Error(`Unable to find environment variable for $${SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); |
| 19977 | } |
| 19978 | try { |
| 19979 | yield access(pathFromEnv, import_fs.constants.R_OK | import_fs.constants.W_OK); |
| 19980 | } catch (_a) { |
| 19981 | throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); |
| 19982 | } |
| 19983 | this._filePath = pathFromEnv; |
| 19984 | return this._filePath; |
| 19985 | }); |
no test coverage detected