Skip to content

Commit 0dbc43a

Browse files
committed
added index in pipeline name
1 parent c310eb8 commit 0dbc43a

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) => {
@@ -57,15 +57,15 @@ app.post('/', bodyParser.json(), async (req, res) => {
5757
}
5858
}
5959

60-
const trimmedSteps = py.steps.filter(s => {
60+
const trimmedSteps = py.steps.filter((s, index) => {
6161
if (!s.when || !s.when.changeset || !s.when.changeset.includes) return true
6262
const requiredFiles = s.when.changeset.includes
6363
const matchedFiles = glob.match(requiredFiles, filesChanged, { dot: true })
6464
console.log('Matched files for step:', matchedFiles.length, 'Allowed matches:', requiredFiles)
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)