microsoft/powerplatform-actions

Node.js 12 actions are deprecated.

meywenz opened this issue · 0 comments

Hi there.

I am having an issue with our custom ALM application that was created by our colleague who left the company. The app was working fine until now. One of the flows made in Power apps triggers yml script to deploy solution between environments.

Today we have encountered the following issue.

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout, microsoft/powerplatform-actions, microsoft/powerplatform-actions, microsoft/powerplatform-actions, microsoft/powerplatform-actions, microsoft/powerplatform-actions, actions/checkout

failed: Connected to...BuildEnvForSales Order Bus - Latin America
Solution Importing...
Waiting for asynchronous operation a18e4f4f-7903-43f9-af7e-4c29217b490d to complete with timeout of 01:00:00
Processing asynchronous operation... execution time: 00:00:00 and 0.01% complete
Processing asynchronous operation... execution time: 00:00:04 and 0.13% complete
Processing asynchronous operation... execution time: 00:00:08 and 0.25% complete
Processing asynchronous operation... execution time: 00:00:13 and 0.37% complete
Processing asynchronous operation... execution time: 00:00:17 and 0.48% complete
Processing asynchronous operation... execution time: 00:00:21 and 0.61% complete
Processing asynchronous operation... execution time: 00:00:26 and 0.73% complete
Processing asynchronous operation... execution time: 00:00:30 and 0.84% complete
Processing asynchronous operation... execution time: 00:00:34 and 0.96% complete
Processing asynchronous operation... execution time: 00:00:38 and 1.07% complete
Processing asynchronous operation... execution time: 00:00:42 and 1.19% complete
Processing asynchronous operation... execution time: 00:00:46 and 1.30% complete
Processing asynchronous operation... execution time: 00:00:51 and 1.42% complete
Processing asynchronous operation... execution time: 00:00:55 and 1.53% complete
Processing asynchronous operation... execution time: 00:00:59 and 1.65% complete
Processing asynchronous operation... execution time: 00:01:03 and 1.76% complete
Processing asynchronous operation... execution time: 00:01:07 and 1.88% complete
Processing asynchronous operation... execution time: 00:01:11 and 2.00% complete
Processing asynchronous operation... execution time: 00:01:15 and 2.11% complete
Processing asynchronous operation... execution time: 00:01:20 and 2.23% complete
Processing asynchronous operation... execution time: 00:01:24 and 2.34% complete
Processing asynchronous operation... execution time: 00:01:28 and 2.46% complete
Processing asynchronous operation... execution time: 00:01:32 and 2.57% complete
Processing asynchronous operation... execution time: 00:01:36 and 2.69% complete
Processing asynchronous operation... execution time: 00:01:40 and 2.80% complete
Processing asynchronous operation... execution time: 00:01:45 and 2.92% complete
Processing asynchronous operation... execution time: 00:01:49 and 3.04% complete
Processing asynchronous operation... execution time: 00:01:53 and 3.15% complete
Processing asynchronous operation... execution time: 00:01:57 and 3.27% complete
Processing asynchronous operation... execution time: 00:02:01 and 3.38% complete
Processing asynchronous operation... execution time: 00:02:05 and 3.50% complete
Processing asynchronous operation... execution time: 00:02:10 and 3.61% complete
Processing asynchronous operation... execution time: 00:02:14 and 3.73% complete
Processing asynchronous operation... execution time: 00:02:18 and 3.84% complete
Processing asynchronous operation... execution time: 00:02:22 and 3.96% complete
Processing asynchronous operation... execution time: 00:02:26 and 4.07% complete
Processing asynchronous operation... execution time: 00:02:30 and 4.19% complete
Processing asynchronous operation... execution time: 00:02:34 and 4.31% complete
Processing asynchronous operation... execution time: 00:02:39 and 4.42% complete
Processing asynchronous operation... execution time: 00:02:43 and 4.54% complete
Processing asynchronous opera

I am not the person who created this solution and I don't have experience with yml scripts.

I would like to get to know where to start fixing this issue and how can make these script work again.

If the code of one of the scripts is needed, there it is:

name: Deploy To Test Environment First Deployment

# Currently triggering this workflow on custom events, using the api https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
# Can be easily changed to other events https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
# NOTE: You have to change env variables with appropriate values, if you are modifying it.
on:
 repository_dispatch:
   types: [deploy_to_test_ini]

jobs:
  build:

    env:
     solutionName: ${{ github.event.client_payload.solutionname }}
     branchName: ${{ github.event.client_payload.branch }}
     notes: ${{ github.event.client_payload.notes }}
     sourceEnvironmentUserId: ${{ github.event.client_payload.sourceenvironmentuserid }}
     sourceEnvironmentSecretName: ${{ github.event.client_payload.sourceenvironmentsecretname }}
     sourceEnvironmentUrl: ${{ github.event.client_payload.sourceenvironmenturl }}
     targetEnvironmentUserId: ${{ github.event.client_payload.targetenvironmentuserid }}
     targetEnvironmentSecretName: ${{ github.event.client_payload.targetenvironmentsecretname }}
     targetEnvironmentUrl: ${{ github.event.client_payload.targetenvironmenturl }}
     # build variable will go away once we use actions to create the environment
     buildEnvironmentUserId: ${{ github.event.client_payload.buildenvironmentuserid }}
     buildEnvironmentSecretName: ${{ github.event.client_payload.buildenvironmentsecretname }}
     buildEnvironmentUrl: ${{ github.event.client_payload.buildenvironmenturl }}
     requestId: ${{ github.event.client_payload.requestid }}
     projectId: ${{ github.event.client_payload.projectid }}

    runs-on: windows-2019

    steps:
    - name: 'Clone this repo'
      uses: actions/checkout@v2-beta

    # Github api create-a-repository-dispatch-event doesn't allow more than 10 properties in the client_payload
    # Hence we are using a request object inside a client_payload to take additional properties.
    # This step can be ignored if using the workflow based on the default events.
    - name: 'Parsing the request from event client_payload'
      id: parse-client-payload-request
      run: |
        $requestPayload = echo "${{ github.event.client_payload.request }}"
        $requestPayloadObj = $requestPayload | ConvertFrom-Json
        $hashProperties = @{}
        foreach ($property in $requestPayloadObj.PSObject.Properties) {
          echo "$($property.Name) :: $($property.value)"
          $hashProperties[$property.Name] = $property.Value
        }
        echo "buildEnvironmentUserId=$($hashProperties.buildenvironmentuserid)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "buildEnvironmentSecretName=$($hashProperties.buildenvironmentsecretname)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "buildEnvironmentUrl=$($hashProperties.buildenvironmenturl)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "requestId=$($hashProperties.requestid)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "projectId=$($hashProperties.projectId)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
        echo "notes=$($hashProperties.notes)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
    - name: 'Export the solution from Dev (source) environment'
      id: export-dev
      uses: microsoft/powerplatform-actions/export-solution@v0
      with:
        user-name: ${{ env.sourceEnvironmentUserId }}
        password-secret: ${{ secrets[env.sourceEnvironmentSecretName] }}
        solution-name: ${{ env.solutionName }}
        environment-url: ${{ env.sourceEnvironmentUrl }}
        solution-output-file: "${{ env.solutionName }}.zip"
        run-asynchronously: true

    - name: 'Unpack the exported solution'
      id: unpack-dev
      uses: microsoft/powerplatform-actions/unpack-solution@v0
      with:
        solution-file: "${{ env.solutionName }}.zip"
        solution-folder: "${{ env.solutionName }}"

    - name: 'Commit the unpacked solution to the topic branch'
      id: branch-solution
      uses: microsoft/powerplatform-actions/branch-solution@v0
      with:
       solution-folder: "${{ env.solutionName }}"
       solution-target-folder: "${{ env.solutionName }}"
       repo-token: ${{ secrets.GITHUB_TOKEN }}
       branch-name: ${{ env.branchName }}
       clobber-branch: true
       allow-empty-commit: true

    - name: 'Pack the solution for testing in build environment'
      id: pack-dev
      uses: microsoft/powerplatform-actions/pack-solution@v0
      with:
        solution-folder: ${{env.solutionName}}
        solution-file: "${{env.solutionName}}_Unmanaged.zip"

    - name: 'Import the solution to Build Environment'
      id: import-build
      uses: microsoft/powerplatform-actions/import-solution@v0
      with:
        environment-url: ${{env.buildEnvironmentUrl}}
        user-name: ${{env.buildEnvironmentUserId}}
        password-secret: ${{ secrets[env.buildEnvironmentSecretName] }}
        solution-file: "${{env.solutionName}}_Unmanaged.zip"
        run-asynchronously: true

    - name: 'Export the solution as managed from build environment'
      id: export-build
      uses: microsoft/powerplatform-actions/export-solution@v0
      with:
        user-name: ${{env.buildEnvironmentUserId}}
        password-secret: ${{ secrets[env.buildEnvironmentSecretName] }}
        solution-name: ${{ env.solutionName }}
        environment-url: ${{env.buildEnvironmentUrl}}
        managed: 'true'
        solution-output-file: "${{ env.solutionName }}_managed.zip"
        run-asynchronously: true

    - name: 'Import the managed solution to the Test (target) Environment'
      id: import-test
      uses: microsoft/powerplatform-actions/import-solution@v0
      with:
        environment-url: ${{ env.targetEnvironmentUrl }}
        user-name: ${{ env.targetEnvironmentUserId }}
        password-secret: ${{ secrets[env.targetEnvironmentSecretName] }}
        solution-file: "${{ env.solutionName }}_managed.zip"
        run-asynchronously: true
        
    - name: 'Upload the managed solution to artifact'
      uses: actions/upload-artifact@v2
      with:
        name: ${{env.SolutionName}}
        path: "${{ env.solutionName }}_managed.zip"
     
    # Reading the different power platform action status to upload the status as artifact, to easily communicate it using other jobs.
    - name: Save job status to a file (status.json)
      if: always()
      run: |
        $errors=@{}
        function Process-StepOutputs($stepName, $outCome, $errorMessage) {
          if ($outcome -eq "success" -or $outcome -eq "skipped") {
            return ""
          } else {
            if ($null -ne $errorMessage -and $errorMessage -ne "") {
              $errors["$stepName"] = $errorMessage
            } else {
              $errors["$stepName"] = "Error occured in GitHub action $stepName"
            }
          }
        }
        $outCome = echo "${{ steps.export-dev.outcome }}"
        $errorMsg = echo "${{ steps.export-dev.outputs.errorMessage }}"
        Process-StepOutputs "export-dev" $outCome $errorMsg
        $outCome = echo "${{ steps.unpack-dev.outcome }}"
        $errorMsg = echo "${{ steps.unpack-dev.outputs.errorMessage }}"
        Process-StepOutputs "unpack-dev" $outCome $errorMsg
        $outCome = echo "${{ steps.pack-dev.outcome }}"
        $errorMsg = echo "${{ steps.pack-dev.outputs.errorMessage }}"
        Process-StepOutputs "pack-dev" $outCome $errorMsg
        $outCome = echo "${{ steps.import-build.outcome }}"
        $errorMsg = echo "${{ steps.import-build.outputs.errorMessage }}"
        Process-StepOutputs "import-build" $outCome $errorMsg
        $outCome = echo "${{ steps.export-build.outcome }}"
        $errorMsg = echo "${{ steps.export-build.outputs.errorMessage }}"
        Process-StepOutputs "export-build" $outCome $errorMsg
        $outCome = echo "${{ steps.import-test.outcome }}"
        $errorMsg = echo "${{ steps.import-test.outputs.errorMessage }}"
        Process-StepOutputs "import-test" $outCome $errorMsg
        $jobStatus = echo ${{ job.status }}
        $workflow = echo ${{ github.workflow }}
        $branch = echo ${{ env.branchName }}
        $repo = echo ${{ github.repository }}
        $run = echo ${{ github.run_id }}
        $requestId = echo "${{env.requestId}}"
        $projectid = echo "${{env.projectId}}"
        $errorStr = ConvertTo-Json -InputObject $errors
        $status = @{
          'status' = $jobStatus;
          'workflow' = "$workflow";
          'branch' = $branch;
          'repo' = $repo;
          'run' = $run;
          'requestid' = $requestId;
          'projectid' = "$projectid";
          'errors'= "$errorStr"
        }
        $jsonString = ConvertTo-Json -InputObject $status
        $jsonString > status.json
    - name: Upload job status file as artifact
      if: always()
      uses: actions/upload-artifact@v1
      with:
        name: job_status
        path: status.json

  # This job is to notify the webhook url when the workflow is triggered on the custom event and the payload has the webhook url.
  # Otherwise this job can be ignored.
  notify:
    needs: [build]
    if: always()
    runs-on: windows-latest
    steps:

    - name: Download artifact job_status
      uses: actions/download-artifact@v1
      with:
        name: job_status
      continue-on-error: true

    - name: Reading status & Invoking the webhook
      if: always()
      run: |
        $fileExists = Test-Path job_status/status.json -PathType Leaf
        $uri = echo '${{ github.event.client_payload.webhookurl }}'
        $jsonData = ''
        if ($fileExists) {
          $jsonData = Get-Content job_status/status.json
          echo "Data read from status file :: " $jsonData
        } else {
          $workflow = echo ${{ github.workflow }}
          $branch = echo ${{ github.event.client_payload.branch }}
          $repo = echo ${{ github.repository }}
          $run = echo ${{ github.run_id }}
          $requestId = echo ${{ github.event.client_payload.requestid }}
          $projectid = echo "${{ github.event.client_payload.projectid }}"
          $errors = @{
            "Actions"="Unable to get the status file from the previous job"
          }
          $status = @{
            'status' = "$fileExists";
            'workflow' = "$workflow";
            'branch' = $branch;
            'repo' = $repo;
            'run' = $run;
            'requestid' = $requestId;
            'projectid' = "$projectid";
            'errors' = "$errors"
          }
          $jsonData = ConvertTo-Json -InputObject $status
          echo "Data constructed as status.json file is not present :: " $jsonData
        }
        echo "Invoking the WebHook Url"
        Invoke-RestMethod -Uri $uri -Body $jsonData  -Method POST -ContentType 'application/json'
        echo "Invoked the WebHook Url"

Could I ask for some tip on how to fix it?