mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-24 07:45:02 +01:00
Parse env file discard utf8 bom (#38)
* powershell 5 may add the BOM even when explicitly using utf8 * add test + apply to GITHUB_PATH as well
This commit is contained in:
48
pkg/runner/testdata/windows-add-env-powershell-5/push.yml
vendored
Normal file
48
pkg/runner/testdata/windows-add-env-powershell-5/push.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo $env:GITHUB_ENV
|
||||
echo "key=val" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo "key2<<EOF" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo "line1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo "line2" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo "EOF" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
cat $env:GITHUB_ENV
|
||||
shell: powershell
|
||||
- run: |
|
||||
ls env:
|
||||
if($env:key -ne 'val') {
|
||||
echo "Unexpected value for `$env:key: $env:key"
|
||||
exit 1
|
||||
}
|
||||
if($env:key2 -ne "line1`nline2") {
|
||||
echo "Unexpected value for `$env:key2: $env:key2"
|
||||
exit 1
|
||||
}
|
||||
shell: powershell
|
||||
- run: |
|
||||
echo $env:GITHUB_ENV
|
||||
echo "KEY=test" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
|
||||
# Defect missing append, test is broken!!!
|
||||
echo "Key=expected" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
|
||||
shell: powershell
|
||||
- name: Assert GITHUB_ENV is merged case insensitive
|
||||
run: exit 1
|
||||
if: env.KEY != 'expected' || env.Key != 'expected' || env.key != 'expected'
|
||||
shell: powershell
|
||||
- name: Assert step env is merged case insensitive
|
||||
run: exit 1
|
||||
if: env.KEY != 'n/a' || env.Key != 'n/a' || env.key != 'n/a'
|
||||
env:
|
||||
KeY: 'n/a'
|
||||
shell: powershell
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./windows-add-env-powershell-5/action
|
||||
- name: Assert composite env is merged case insensitive
|
||||
run: exit 1
|
||||
if: env.KEY != 'n/a' || env.Key != 'n/a' || env.key != 'n/a'
|
||||
shell: powershell
|
||||
Reference in New Issue
Block a user