Skip to content

Commit 4f7ad36

Browse files
authored
Merge pull request #6 from remorses/duplicate-pipeline-names
added index in pipeline name
2 parents c310eb8 + 1ea9c51 commit 4f7ad36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ gh.authenticate({ type: 'oauth', token: githubToken })
1616
const determineFilesChanged = createFilesChangedDeterminer(gh)
1717
const getParsedYaml = createParsedYamlRetriever(gh)
1818

19-
const nullYaml = 'kind: pipeline\nname: default\ntrigger:\n event:\n exclude: [ "*" ]'
19+
const nullYaml = index => `kind: pipeline\nname: default_${index}\ntrigger:\n event:\n exclude: [ "*" ]`
2020

2121
const app = express()
2222
app.post('/', bodyParser.json(), async (req, res) => {
@@ -45,7 +45,7 @@ app.post('/', bodyParser.json(), async (req, res) => {
4545
return res.sendStatus(500)
4646
}
4747

48-
const finalYamlDocs = parsedYaml.map(py => {
48+
const finalYamlDocs = parsedYaml.map((py, index) => {
4949
if (py.kind !== 'pipeline') return yaml.stringify(py)
5050
if (py.trigger && py.trigger.changeset && py.trigger.changeset.includes) {
5151
const requiredFiles = py.trigger.changeset.includes
@@ -65,7 +65,7 @@ app.post('/', bodyParser.json(), async (req, res) => {
6565
return matchedFiles.length
6666
})
6767

68-
return trimmedSteps.length ? yaml.stringify({ ...py, steps: trimmedSteps }) : nullYaml
68+
return trimmedSteps.length ? yaml.stringify({ ...py, steps: trimmedSteps }) : nullYaml(index)
6969
})
7070

7171
res.json({ Data: finalYamlDocs.join('\n---\n') })

0 commit comments

Comments
 (0)