I have my powershell function that takes 2 parameters and returns a value in public repo betech branch feature365 here:
https://github.com/knowyrtech/betech/blob/feature365/scripts/xml-functions.ps1
function Get-XMLKeyValue {
param (
[Parameter(Mandatory = $true)]
[string] $XmlPath,
[Parameter(Mandatory = $true)]
[string] $Key
)
$value = (Select-Xml -LiteralPath $XmlPath -XPath "//setParameter[@name='$Key']").Node.Value
Write-Output $value
}
In another public repo actions_param I have github action workflow that needs to call the xml-functions.ps1 function Get-XMLKeyValue and get back the return value:
https://github.com/knowyrtech/actions_param/blob/main/.github/workflows/main.yaml
name: main xml read
on:
push:
branches: main
jobs:
extract_key_value:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Extract XML Key-Value
id: extract-xml-value
uses: ./betech/scripts/xml-functions.ps1@feature365
with:
xmlPath: ${{ env.XML_PATH }}
key: ${{ env.KEY_NAME }}
- name: Show Extracted Key-Value
run: |
echo "Extracted Key-Value: ${{ steps.extract-xml-value.outputs.value }}"
Running the action gets me the below error:
Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under 'D:\a\actions_param\actions_param\betech\scripts\xml-functions.ps1@feature365'. Did you forget to run actions/checkout before running your local action?
I'm not sure if we can call the ps1 file directly. If not how can I reuse the function to get me the values? I'm new to github actions. Kindly suggest.