How Outputs support multiline text? Or is there any other way? #327

Open
opened 2023-08-06 06:40:18 +00:00 by seepine · 3 comments
Contributor

I hava a actions repo seepine/action-test-output

import * as core from '@actions/core'


const a = 'this is a'
const b = 'this is b \n and this is bb'


core.setOutput('a', a)
core.setOutput('b', b)

And in workflow
test.yml

      - uses: seepine/action-test-output@main
        id: test
    
      - run: |
          echo ${{ steps.test.outputs.a }}
          echo ${{ steps.test.outputs.b }}

The log of b is empty

this is a

Now, i use fs.writeFileSync('output.txt', 'content\ncontent line2'), And I want to know if outputs can be implemented

I hava a actions repo `seepine/action-test-output` ```js import * as core from '@actions/core' const a = 'this is a' const b = 'this is b \n and this is bb' core.setOutput('a', a) core.setOutput('b', b) ``` And in workflow test.yml ``` - uses: seepine/action-test-output@main id: test - run: | echo ${{ steps.test.outputs.a }} echo ${{ steps.test.outputs.b }} ``` The log of b is empty ``` this is a ``` > Now, i use fs.writeFileSync('output.txt', 'content\ncontent line2'), And I want to know if outputs can be implemented
wolfogre added the
kind
bug
related
act
labels 2023-08-07 02:06:42 +00:00
Contributor

I get this (version:v0.2.3+10-g1a7ec5f)

this is a
this is b
/var/run/act/workflow/3: line 4: and: command not found

This error is expected, because you should assign the output to an env var and reference it like

- run: |
    echo "$OUTPUT"    
  env:
    OUTPUT: ${{ steps.test.outputs.b }}

Now, i use fs.writeFileSync('output.txt', 'content\ncontent line2')

This is not the right syntax see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter

I get this (version:v0.2.3+10-g1a7ec5f) ``` this is a this is b /var/run/act/workflow/3: line 4: and: command not found ``` This error is expected, because you should assign the output to an env var and reference it like ```yaml - run: | echo "$OUTPUT" env: OUTPUT: ${{ steps.test.outputs.b }} ``` > Now, i use fs.writeFileSync('output.txt', 'content\ncontent line2') This is not the right syntax see <https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter>
Author
Contributor

@ChristopherHX
Actually, i have tried so much, but it can't work

image

@ChristopherHX Actually, i have tried so much, but it can't work ![image](/attachments/ff1ac6b0-e044-475d-8722-0cd8e05082b2)
Contributor

@seepine
I cannot tell you what is wrong without your actual workflow / action content.

Actually, i have tried so much, but it can't work

image

Line 1-6 are syntactically valid, but are affected by script injection.
Line 6-9 are invalid, replace is not an expression function (Gitea could change that, but the current act code of gitea doesn't look like to have it)

I have attached a zip of my test repo (It is literally a copy of the information you have provided in your first post). If that works on your side (e.g. you see the same error as in my comment #327 (comment)) and seepine/action-test-output is also a nodejs action then the issue is your code not act_runner.
However I have not enough information about your current code to help you further.

@seepine I cannot tell you what is wrong without your actual workflow / action content. > Actually, i have tried so much, but it can't work > > ![image](/attachments/ff1ac6b0-e044-475d-8722-0cd8e05082b2) Line 1-6 are syntactically valid, but are affected by script injection. Line 6-9 are invalid, replace is not an expression function (Gitea could change that, but the current act code of gitea doesn't look like to have it) I have attached a zip of my test repo (It is literally a copy of the information you have provided in your first post). If that works on your side (e.g. you see the same error as in my comment https://gitea.com/gitea/act_runner/issues/327#issuecomment-746958) and seepine/action-test-output is also a nodejs action then the issue is your code not act_runner. However I have not enough information about your current code to help you further.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#327
No description provided.