act_runner: step output is not recognized when BOM is present in $GITEA_OUTPUT. Was: Only legacy output seems to be working (on windows) #14064

Open
opened 2025-11-02 11:01:50 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @smu-hf on GitHub (Jan 29, 2025).

Description

With the (shortened) job definition given below, the only way to set a step's output successfully seems to be the legacy way via set-output. Writing to GITEA_OUTPUT does not seem to have any effect and does not successfully set the step's output. See screenshot and attached log below.

defaults:
  run:
    shell: powershell

jobs:
  job1:
    runs-on: windows
    outputs:
      legacy-output: ${{ steps.set-output-legacy.outputs.legacy-output}}
      new-output: ${{ steps.set-output-new.outputs.new-output}}
    steps:
      - id: set-output-legacy
        run: |
          echo "::set-output name=legacy-output::test"
        working-directory: ${{ github.workspace }}
        
      - id: get-output-legacy
        run: |
          echo ${{ steps.set-output-legacy.outputs.legacy-output}}
          echo $env:GITEA_OUTPUT
        working-directory: ${{ github.workspace }}

      - id: set-output-new
        run: echo "new-output=test2" | Out-File -FilePath $env:GITEA_OUTPUT -Encoding utf8 -Append

      - id: get-output-new
        run: echo "${{ steps.set-output-new.outputs.new-output}}"

      - id: get-powershell-version
        run: echo $PSVersionTable.PSVersion

Gitea Version

1.23.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/smu-hf/14f8d07b1d9604e20577f5c2d0b311eb

Screenshots

Image

Test-job1-862.log

Git Version

git version 2.47.1.windows.1

Operating System

Windows Server 2022 21H2 Build 20348.2527

How are you running Gitea?

Gitea and act_runner (v0.2.11) installed from the official sources.
act_runner in host mode on Windows Server 2022 21H2 Build 20348.2527

Gitea is running as a Windows service
act_runner is running via nssm (see issue #33428)

Database

MSSQL

Originally created by @smu-hf on GitHub (Jan 29, 2025). ### Description With the (shortened) job definition given below, the only way to set a step's output successfully seems to be the legacy way via set-output. Writing to GITEA_OUTPUT does not seem to have any effect and does not successfully set the step's output. See screenshot and attached log below. ``` defaults: run: shell: powershell jobs: job1: runs-on: windows outputs: legacy-output: ${{ steps.set-output-legacy.outputs.legacy-output}} new-output: ${{ steps.set-output-new.outputs.new-output}} steps: - id: set-output-legacy run: | echo "::set-output name=legacy-output::test" working-directory: ${{ github.workspace }} - id: get-output-legacy run: | echo ${{ steps.set-output-legacy.outputs.legacy-output}} echo $env:GITEA_OUTPUT working-directory: ${{ github.workspace }} - id: set-output-new run: echo "new-output=test2" | Out-File -FilePath $env:GITEA_OUTPUT -Encoding utf8 -Append - id: get-output-new run: echo "${{ steps.set-output-new.outputs.new-output}}" - id: get-powershell-version run: echo $PSVersionTable.PSVersion ``` ### Gitea Version 1.23.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/smu-hf/14f8d07b1d9604e20577f5c2d0b311eb ### Screenshots ![Image](https://github.com/user-attachments/assets/20215fb6-285f-4f2f-af6f-e006d9ddffcb) [Test-job1-862.log](https://github.com/user-attachments/files/18587368/Test-job1-862.log) ### Git Version git version 2.47.1.windows.1 ### Operating System Windows Server 2022 21H2 Build 20348.2527 ### How are you running Gitea? Gitea and act_runner (v0.2.11) installed from the official sources. act_runner in host mode on Windows Server 2022 21H2 Build 20348.2527 Gitea is running as a Windows service act_runner is running via nssm (see issue #33428) ### Database MSSQL
GiteaMirror added the type/bug label 2025-11-02 11:01:50 -06:00
Author
Owner

@smu-hf commented on GitHub (Jan 29, 2025):

One thing I just noticed when writing to another file using the same syntax (echo "foo" | Out-File -FilePath file.txt -Encoding utf8 -Append) was that powershell v5.* seems to default to UTF8 with BOM when utf8 encoding is specified. Maybe this causes the observed issues? I will test that and report back.

@smu-hf commented on GitHub (Jan 29, 2025): One thing I just noticed when writing to another file using the same syntax `(echo "foo" | Out-File -FilePath file.txt -Encoding utf8 -Append)` was that powershell v5.* seems to default to UTF8 with BOM when utf8 encoding is specified. Maybe this causes the observed issues? I will test that and report back.
Author
Owner

@smu-hf commented on GitHub (Jan 29, 2025):

Ok, it looks like that is actually the issue:

I modified the workflow definition from above like this:

      - id: set-output-new
        working-directory: ${{ github.workspace }}
        run: Copy-item -Path 'E:\test.txt' -destination $env:GITEA_OUTPUT -Force

and manually created a text file with the content new-output=test2 while making sure to use UTF8 without BOM.

Now it seems to work:

Image

@smu-hf commented on GitHub (Jan 29, 2025): Ok, it looks like that is actually the issue: I modified the workflow definition from above like this: ``` - id: set-output-new working-directory: ${{ github.workspace }} run: Copy-item -Path 'E:\test.txt' -destination $env:GITEA_OUTPUT -Force ``` and manually created a text file with the content `new-output=test2` while making sure to use UTF8 without BOM. Now it seems to work: ![Image](https://github.com/user-attachments/assets/dc2bc97c-ef02-48a2-91f2-c2d869f5653f)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14064