Github Actions - Unable to get called / checkout reusable workflow's repository

436 Views Asked by At

Note: Both the caller and called reusable repo are public and their permissions are correctly set.

Below is my caller repo actions_param workflow test.yml:

name: TEST  main xml read

on:
  push:
    branches: main
    
jobs:
  inside_actionyml:
    uses: knowyrtech/betech/.github/workflows/extractxmldata.yml@feature365
    with:
      xml_Path: 'D:\myxl\setparam.xml'
      key_name: 'app_name'

As you can see it calls betech's extractxmldata.yml from branch feature365.

This workflow will help get values from xml given the key by invoking xml-functions.ps1.

name: Read XML

on:
  workflow_call:
    inputs:
        xml_Path:
          required: true
          default: ''
          type: string
        key_name:
          required: true
          default: ''
          type: string      
  
jobs: 
  Extract-keys:
    runs-on: 'windows-latest'
    steps:
      - uses: actions/checkout@v3

      - name: Get present dir
        run: |
          Get-Location

      - name: List dir
        run: |
          dir   

      - name: Call power shell for extract XML values
        run: |
          set-location "${{ github.workspace }}\betech\scripts"
          ./xml-functions.ps1 "${{ inputs.xml_Path }}" "${{ inputs.key_name }}"

xml-functions.ps1 is placed under the repo's scripts folder as you may see here.

The called workflow calls the reusable workflow however the reusable workflow does not find the reusable repo and its file xml-functions.ps1 and throws an error as seen in the snapshot below:

error

Run set-location "D:\a\actions_param\actions_param\betech\scripts"
Set-Location: D:\a\_temp\0e075a8f-0439-43fc-9c45-1397748c0d29.ps1:2
Line |
   2 |  set-location "D:\a\actions_param\actions_param\betech\scripts"
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'D:\a\actions_param\actions_param\betech\scripts' because it does not exist.

Error: Process completed with exit code 1.

I tried the same on local Windows runner too and observed that the reusable repo betech does not get checkout [downloaded] at the runner at all and hence it fails to find xml-functions.ps1.

All I m concerned and need help is how to get xml-functions.ps1 looked up and called.

0

There are 0 best solutions below