OSDN Git Service

GitHub ActionsでのPull Requestのビルド時にブランチのHEADをチェックアウトする
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 4 Dec 2023 06:23:31 +0000 (15:23 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Mon, 4 Dec 2023 07:54:18 +0000 (16:54 +0900)
デフォルトでは自動生成された develop ブランチとのマージコミットをチェックアウトしている

.github/workflows/build.yml

index 8ace1bd..b540e7f 100644 (file)
@@ -14,6 +14,8 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
 
       - name: Add msbuild to PATH
         uses: microsoft/setup-msbuild@v1.1
@@ -55,6 +57,8 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v3
+        with:
+          ref: ${{ github.event.pull_request.head.sha }}
 
       - name: Add msbuild to PATH
         uses: microsoft/setup-msbuild@v1.1
@@ -169,8 +173,7 @@ jobs:
           $env:PATH = $env:PATH + ';C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\Current\Bin\Roslyn\'
           $binDir = '.\OpenTween\bin\' + $env:CONFIGURATION + '\net48\'
           $destPath = 'OpenTween.zip'
-          $headCommit = '${{ github.event.pull_request.head.sha }}'
-          .\tools\build-zip-archive.ps1 -BinDir $binDir -DestPath $destPath -HeadCommit $headCommit
+          .\tools\build-zip-archive.ps1 -BinDir $binDir -DestPath $destPath
 
       - name: Upload build result
         uses: actions/upload-artifact@v3