Skip to content

Commit

Permalink
updated the api version the action uses
Browse files Browse the repository at this point in the history
  • Loading branch information
hevans-dglcom committed Jun 12, 2023
1 parent 8d90c1a commit 3bcfd96
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,30 @@ spec:
ui:options:
allowedHosts:
- dev.azure.com
- title: Choose Pipeline Parameters
description: Please select some pipeline parameters
properties:
pipelineParameters:
title: Pipeline Parameters
type: object
properties:
name:
type: string
id:
type: number
- title: Choose Pipeline Variables
description: Please select some pipeline variables
properties:
pipelineParameters:
title: Pipeline Variables
type: object
properties:
name:
type: string
id:
type: number

***note these properties for parameters and variables are just examples, you can use whatever key values that your pipeline will accept@!"

steps:
- id: fetch
Expand Down
15 changes: 9 additions & 6 deletions src/actions/run/runAzurePipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ interface RunPipelineRequest {
templateParameters?: {
[key: string]: string;
};
variables?: {
[key: string]: string;
};
variables?: string;
yamlOverrides?: string;
}

Expand Down Expand Up @@ -161,6 +159,8 @@ export const runAzurePipelineAction = (options: {
const token = ctx.input.token ?? integrationConfig.config.token!;

ctx.logger.info(`Running Azure pipeline with the ID ${pipelineId}.`);

const variablesString = JSON.stringify(pipelineVariables)

const request: RunPipelineRequest = {
resources: {
Expand All @@ -171,16 +171,19 @@ export const runAzurePipelineAction = (options: {
},
},
templateParameters: pipelineParameters as Record<string, string>,
variables: pipelineVariables as Record<string, string>,
yamlOverrides: "",
};

if (variablesString !== null) {
request.variables = variablesString;
}

const body = JSON.stringify(request);

// See the Azure DevOps documentation for more information about the REST API:
// https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-6.1
// https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-7.0
await fetch(
`https://${host}/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=6.1-preview.1`,
`https://${host}/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=7.0`,
{
method: "POST",
headers: {
Expand Down

0 comments on commit 3bcfd96

Please sign in to comment.