Skip to content

Commit 73d675c

Browse files
authored
Merge pull request #232 from Opentrons/set-output-fix
fix(build warnings): no more set-output
2 parents b55853b + 185a3c9 commit 73d675c

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

.github/actions/build-refs/action/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { getOctokit } from '@actions/github'
22
import * as core from '@actions/core'
33
import * as semver from 'semver'
4+
import * as fs from 'fs'
5+
import * as path from 'path'
46

57
export type Repo = 'oe-core' | 'monorepo' | 'ot3-firmware'
68
export type BuildType = 'develop' | 'release'
@@ -302,6 +304,17 @@ export function resolveBuildType(ref: Ref): BuildType {
302304
return ref.includes('refs/tags') ? 'release' : 'develop'
303305
}
304306

307+
function setOutput(name: string, value: string): void {
308+
const outputFile = process.env['GITHUB_OUTPUT']
309+
if (!outputFile) {
310+
throw new Error('GITHUB_OUTPUT environment variable is not set')
311+
}
312+
313+
// Append to the output file with proper formatting
314+
const output = `${name}=${value}\n`
315+
fs.appendFileSync(outputFile, output)
316+
}
317+
305318
async function run() {
306319
const inputs = getInputs()
307320
inputs.forEach((ref, repo) => {
@@ -328,8 +341,8 @@ async function run() {
328341
attemptable.forEach((refs, repo) => {
329342
core.debug(`found attemptable refs for ${repo}: ${refs.join(', ')}`)
330343
})
331-
core.setOutput('build-type', buildType)
332-
core.setOutput('variant', buildVariant)
344+
setOutput('build-type', buildType)
345+
setOutput('variant', buildVariant)
333346

334347
const resolved = await resolveRefs(attemptable, buildVariant)
335348
resolved.forEach((ref, repo) => {
@@ -339,7 +352,7 @@ async function run() {
339352
)
340353
}
341354
core.info(`Resolved ${repo} to ${ref}`)
342-
core.setOutput(repo, ref)
355+
setOutput(repo, ref)
343356
})
344357
}
345358

.github/actions/build-refs/dist/index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34581,6 +34581,8 @@ __nccwpck_require__.r(__webpack_exports__);
3458134581
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_1__);
3458234582
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(2088);
3458334583
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__);
34584+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(9896);
34585+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nccwpck_require__.n(fs__WEBPACK_IMPORTED_MODULE_3__);
3458434586
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
3458534587
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3458634588
return new (P || (P = Promise))(function (resolve, reject) {
@@ -34593,6 +34595,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
3459334595

3459434596

3459534597

34598+
3459634599
const orderedRepos = ['monorepo', 'oe-core', 'ot3-firmware'];
3459734600
function mainRefFor(input) {
3459834601
return {
@@ -34803,6 +34806,15 @@ function resolveRefs(toAttempt, variant) {
3480334806
function resolveBuildType(ref) {
3480434807
return ref.includes('refs/tags') ? 'release' : 'develop';
3480534808
}
34809+
function setOutput(name, value) {
34810+
const outputFile = process.env['GITHUB_OUTPUT'];
34811+
if (!outputFile) {
34812+
throw new Error('GITHUB_OUTPUT environment variable is not set');
34813+
}
34814+
// Append to the output file with proper formatting
34815+
const output = `${name}=${value}\n`;
34816+
fs__WEBPACK_IMPORTED_MODULE_3__.appendFileSync(outputFile, output);
34817+
}
3480634818
function run() {
3480734819
return __awaiter(this, void 0, void 0, function* () {
3480834820
const inputs = getInputs();
@@ -34823,15 +34835,15 @@ function run() {
3482334835
attemptable.forEach((refs, repo) => {
3482434836
_actions_core__WEBPACK_IMPORTED_MODULE_1__.debug(`found attemptable refs for ${repo}: ${refs.join(', ')}`);
3482534837
});
34826-
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('build-type', buildType);
34827-
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('variant', buildVariant);
34838+
setOutput('build-type', buildType);
34839+
setOutput('variant', buildVariant);
3482834840
const resolved = yield resolveRefs(attemptable, buildVariant);
3482934841
resolved.forEach((ref, repo) => {
3483034842
if (!ref) {
3483134843
throw new Error(`Could not resolve ${repo} input reference ${inputs.get(repo)}`);
3483234844
}
3483334845
_actions_core__WEBPACK_IMPORTED_MODULE_1__.info(`Resolved ${repo} to ${ref}`);
34834-
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput(repo, ref);
34846+
setOutput(repo, ref);
3483534847
});
3483634848
});
3483734849
}

0 commit comments

Comments
 (0)