Skip to content

Commit 05baccd

Browse files
committed
feat: using core.setOutput for transferring outputs between steps
1 parent 1864729 commit 05baccd

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

.github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ jobs:
6464
milliseconds: 2000
6565

6666
# echo outputs from test-action's stdout
67-
- name: Set Output
68-
id: set-output
67+
- name: Echo Output
68+
id: echo-output
6969
run:
7070
echo "::set-output name=time::$(cat ${{
71-
steps.test-action.outputs.stdout }})"
71+
steps.test-action.outputs.result }})"
7272

7373
- name: Post comment on PR
7474
uses: peter-evans/create-or-update-comment@v4
@@ -80,7 +80,7 @@ jobs:
8080
- With GitHub **Markdown** :sparkles:
8181
- Created by [create-or-update-comment][1]
8282
- and testing openapi diff
83-
${{ steps.test-action.outputs.stdout }}
83+
${{ steps.test-action.outputs.result }}
8484
[1]: https://github.com/peter-evans/create-or-update-comment
8585
reactions: '+1'
8686

dist/index.js

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as core from '@actions/core'
22
import { wait } from './wait'
33
import { stdout } from 'process'
4-
import * as fs from 'fs'
54

65
/**
76
* The main function for the action.
@@ -45,7 +44,7 @@ export async function run(): Promise<void> {
4544

4645
console.log(result)
4746

48-
fs.writeFileSync(process.env.GITHUB_OUTPUT!, `${'test-action'}=${result}`)
47+
core.setOutput('result', result)
4948
} catch (error) {
5049
// Fail the workflow run if an error occurs
5150
if (error instanceof Error) core.setFailed(error.message)

0 commit comments

Comments
 (0)