Last active
October 24, 2019 17:26
-
-
Save cdupuis/9fa39de0a8795d3a229028ffee67e6ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
goal, | |
hasFile, | |
PlannedGoal, | |
SdmGoalState, | |
} from "@atomist/sdm"; | |
import { configure } from "@atomist/sdm-core"; | |
/** | |
* Atomist SDM Sample | |
* @description SDM demonstrate dynamic goals | |
* @tag sdm,generator,dotnet-core | |
*/ | |
export const configuration = configure(async sdm => { | |
const messageGoal = goal({ displayName: "Message" }, async gi => { | |
await gi.addressChannels(`Hello ${gi.parameters.count}`); | |
}); | |
messageGoal.plan = async ci => { | |
const countFile = await ci.project.getFile("count"); | |
const counter: number = +(await countFile.getContent()).trim(); | |
const goals: PlannedGoal[] = []; | |
for (let i = 0; i < counter; i++) { | |
goals.push({ | |
details: { | |
displayName: `Message #${i}`, | |
}, | |
parameters: { | |
count: i, | |
}, | |
}); | |
} | |
return { | |
count: { | |
goals, | |
}, | |
}; | |
}; | |
return { | |
plan: { | |
test: hasFile("count"), | |
goals: messageGoal, | |
}, | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment