Amadevus / pwsh-script

GitHub Action to run PowerShell scripts in a rich, prepared scope - inspired by actions/github-script.
MIT License
47 stars 8 forks source link

Action not finishing #3

Closed stefankip closed 3 years ago

stefankip commented 4 years ago

Hi! First of all thanks for sharing this action! I'm calling a powershell script like this:

- name: Deploy to Umbraco Cloud
  uses: Amadevus/pwsh-script@v1.0.0
  env:
    GIT_ADDRESS: ${{ secrets.GIT_ADDRESS }}
    GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
    GIT_PASSWORD: ${{ secrets.GIT_PASSWORD }}
  with:
    script: . ".\$env:DEPLOY_SCRIPT" -cloneurl "$env:GIT_ADDRESS" -uaasuser "$env:GIT_USERNAME" -password "$env:GIT_PASSWORD" -sourcepath "$env:PUBLISH_DIR" -destinationpath "$env:CLONE_DIR"

The script is running fine, these are the final lines in the script:

Write-Host "Deployment finished"

Write-Verbose "Leaving script DeployToUmbracoCloud.ps1"

I can see the Deployment finished echo in the logs, but the action isn't finishing, it keeps running forever. How can I make sure the process finished?

amis92 commented 4 years ago

Hi! I'm glad you've found this project useful.

With these details, it's impossible for me to diagnose the issue.

However, seeing as your script executes fully, and the action keeps running, I would guess there's some child process started that doesn't end.

Can you try to add the following to the end of your script?

Get-Process | Where-Object {$_.Parent.Id -eq $PID } | Format-Table | Out-String | Write-Host

To attempt killing any such processes, do

Get-Process | Where-Object {$_.Parent.Id -eq $PID } | Stop-Process

Indeed, if this turns out to be the culprit, I might add such a command to the host script in this action.

stefankip commented 4 years ago

I just finished my set-up by calling the script directly:

- name: Deploy to Umbraco Cloud
  run: .\${{ env.DEPLOY_SCRIPT }} -cloneurl "${{ secrets.GIT_ADDRESS }}" -uaasuser "${{ secrets.GIT_USERNAME }}" -password "${{ secrets.GIT_PASSWORD }}" -sourcepath "${{ env.PUBLISH_DIR }}" -destinationpath "${{ env.CLONE_DIR }}"
amis92 commented 3 years ago

Closed due to not enough details.