Skip to content

Commit

Permalink
Fix encoding issue with commit message file
Browse files Browse the repository at this point in the history
The commitMsg.txt file created by Powershell started with an unknown
character that git could not consume. This error is not easy to
detect with powershell but shows up in gitbash for windows when using
the 'cat' command to inspect the commitMsg.txt file.
  • Loading branch information
feerrenrut committed Oct 10, 2022
1 parent e28b6be commit 3f8fbc6
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
run:
shell: powershell
steps:
- name: Current dir
- name: Current dir and PS version
run: |
'CurrentDir: ' + (Get-Location)
$PSVersionTable.PSVersion
- name: Checkout source nvda-microsoft-ui-uiautomation
uses: actions/checkout@v3
with:
Expand All @@ -29,7 +30,8 @@ jobs:
New-Item -ItemType "directory" "build"
Set-Location source
./build.ps1 -SubmoduleDir "microsoft-ui-uiautomation" -OutDir "../build"
- name: Checkout gen branch into separate folder
tree ../build /f
- name: Checkout main-out branch into separate folder
uses: actions/checkout@v3
with:
repository: nvaccess/nvda-microsoft-ui-uiautomation
Expand All @@ -38,21 +40,26 @@ jobs:
- name: Empty destination directory
# empty the 'out' folder directory, but don't delete .git, or the top level directory.
run: |
Get-ChildItem gen -Exclude .git | Remove-Item
Get-Location
tree out /f
Get-ChildItem out -Exclude .git | Remove-Item
tree out /f
- name: Copy files
run: |
Get-Location
./source/copyFiles.ps1 -RepoRoot "source" -BuildDir "build" -DestDir "out"
tree out /f
- name: Commit and push
run: |
# this is a git '--pretty=format' string
# %h is SHA, %n is newline,
# %s is commit message subject, %b is commit message body
$COMMIT_FORMAT="Generated from %h%n%nCommit message:%n%s%n%b"
Write-Output $COMMIT_FORMAT
$prettyArg = $("--pretty=format:"+$COMMIT_FORMAT)
Write-Output $prettyArg
Set-Location source
git log -1 HEAD $prettyArg > ../commitMsg.txt
$(git log -1 HEAD $prettyArg) | out-file -FilePath ../commitMsg.txt -Encoding ASCII
Get-ChildItem ../
Get-Content ../commitMsg.txt
Set-Location ../out
$status = $(git status --porcelain)
if($status) {
Expand All @@ -62,7 +69,8 @@ jobs:
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -F ../commitMsg.txt
git status --short
git commit --file="../commitMsg.txt"
git push
} else {
Write-Output "No changes"
Expand Down

0 comments on commit 3f8fbc6

Please sign in to comment.