Skip to content

Commit

Permalink
git workflow to run commands and commit result.
Browse files Browse the repository at this point in the history
  • Loading branch information
feerrenrut committed Oct 10, 2022
1 parent 63d752a commit 90091af
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ jobs:
uses: microsoft/[email protected]
- name: Build source
run: |
cd source
$SlnFile = "microsoft-ui-uiautomation/src/uiAutomation/UIAutomation.sln"
msbuild $SlnFile /t:Restore /p:RestorePackagesConfig=true,Configuration=Release,Platform=x86
Set-Location source
New-Item -ItemType "directory" "out"
./build.ps1
- name: Checkout gen branch into separate folder
uses: actions/checkout@v3
with:
repository: nvaccess/nvda-microsoft-ui-uiautomation
path: gen
ref: main-out
- name: Empty destination directory
# empty the 'gen' folder directory, but don't delete .git, or the top level directory.
run: |
Get-ChildItem gen -Exclude .git | Remove-Item
- name: Copy files
run: |
./source/copyFiles.ps1 -RepoRoot "source" -BuildDir "out" -DestDir "gen"
- name: Commit and push
run: |
Set-Location source
$prettyArg = $("--pretty=format:"+$env:COMMIT_FORMAT)
git log -1 HEAD $prettyArg > ../commitMsg.txt
Set-Location ../gen
$status = $(git status --porcelain)
if($status) {
# Changes, use git status to add to log file for debugging.
Write-Output "Changes detected, committing."
git status --short
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -F ../commitMsg.txt
git push
} else {
Write-Output "No changes"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
out/*
commitMsg.txt

0 comments on commit 90091af

Please sign in to comment.