Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the ability to specify a custom path to a configuration file #1291

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions extension/task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
}
],
"inputs": [
{
"name": "configFilePath",
"type": "string",
"groupName": "advanced",
"label": "Overrides the default path to the configuration file",
"required": false,
"helpMarkDown": "When set, provided path will used to find configuration yaml file instead of the default ones."
},
{
"name": "useUpdateScriptvNext",
"type": "boolean",
Expand Down
11 changes: 10 additions & 1 deletion extension/task/utils/getSharedVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export interface ISharedVariables {
/** Tag of the docker image to be pulled */
dockerImageTag: string;

/** Custom path to the configuration file */
configFilePath: string;
configFilePathOverridden: boolean

/** Dependabot command to run */
command: string;
}
Expand Down Expand Up @@ -162,6 +166,8 @@ export default function getSharedVariables(): ISharedVariables {
? "update_script_vnext"
: "update_script";

let configFilePath: string = tl.getInput("configFilePath");
let configFilePathOverridden: boolean = typeof configFilePath === "string";
return {
organizationUrl: formattedOrganizationUrl,
protocol,
Expand Down Expand Up @@ -203,6 +209,9 @@ export default function getSharedVariables(): ISharedVariables {

dockerImageTag,

command
command,

configFilePath,
configFilePathOverridden
};
}
2 changes: 1 addition & 1 deletion extension/task/utils/parseConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import axios from "axios";
* @returns {IDependabotConfig} config - the dependabot configuration
*/
async function parseConfigFile(variables: ISharedVariables): Promise<IDependabotConfig> {
const possibleFilePaths = [
const possibleFilePaths = variables.configFilePathOverridden ? [variables.configFilePath] : [
"/.azuredevops/dependabot.yml",
"/.azuredevops/dependabot.yaml",

Expand Down