Repository navigation
GitHub Actions Importer converts ADO pipeline parameters into inputs but do not change the references #355
|
Converting Azure DevOps pipelines into GitHub Actions workflows and I am finding that the parameters of the ADO pipeline are correctly translated into inputs (in this case in For the following ADO pipeline: trigger: none
parameters:
- name: zipFile
displayName: "ZIP file name"
type: string
default: ""
- name: username
displayName: "Username"
type: string
default: ""
- name: password
displayName: "Password"
type: string
default: ""
...The Importer generates the following GHA workflow definition: on:
workflow_dispatch:
inputs:
zipFile:
description: ZIP file name
default: ''
type: string
required: false
username:
description: Username
default: ''
type: string
required: false
password:
description: Password
default: ''
type: string
required: false
pull_request:
branches:
- main
...At this point, all is going well. The thing is that along the ADO pipeline there are references to the parameters and those have to be converted in the GHA workflow too. Example of a step in an ADO pipeline: - script: |
echo "Installing zip tool..."
sudo apt-get update
sudo apt-get install -y zip
zip "${{ parameters.zipFile }}" secret.txt
displayName: "ZIP"Step converted into GHA format: - name: ZIP
run: |-
echo "Installing zip tool..."
sudo apt-get update
sudo apt-get install -y zip
zip "${{ parameters.zipFile }}" secret.txtThe reference to the parameter in GHA must be: |
Replies: 1 comment 3 replies
|
importer mapped ADO so the conversion is half-done: inputs block OK, references not rewritten. do this first (workaround) after # review the diff - then rewrite ADO parameter refs to GHA inputs
sed -i 's/\${{ parameters\./${{ inputs./g' .github/workflows/*.ymlor the same replace in your editor across the generated workflow(s). watch for any ADO template expressions you don’t want touched (rare if this file is fully converted). also: don’t put secrets like worth filing/👍 an importer bug if there isn’t one already: “parameters → inputs created, but |
importer mapped ADO
parameters:→on.workflow_dispatch.inputsbut left the body on ADO syntax.${{ parameters.zipFile }}is not valid Actions - that should be${{ inputs.zipFile }}forworkflow_dispatch(and${{ inputs.* }}inside a reusable workflow that declareson.workflow_call.inputs).so the conversion is half-done: inputs block OK, references not rewritten.
do this first (workaround) after
gh actions-importer/ dry-run output:or the same replace in your editor across the generated workflow(s). watch for any ADO template expressions you don’t want touc…