Skip to content

Commit 3fcfb62

Browse files
author
Adam Duncan
committed
Make compatible with Drone Config Plugin Pipeline
1 parent be486c9 commit 3fcfb62

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pipeline:
2525
+ includes: [ **/**.go ]
2626
```
2727

28+
This plugin is compatible with the [Drone Config Plugin Pipeline](https://github.com/microadam/drone-config-plugin-pipeline)
29+
2830
## Installation
2931

3032
PLEASE NOTE: At the moment it supports only github.com installations.

lib/parsed-yaml-retriever.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
const { promisify } = require('util')
22
const yaml = require('yamljs')
33
const getParsedYaml = gh => async data => {
4-
let file = null
5-
const options = {
6-
user: data.repo.namespace,
7-
repo: data.repo.name,
8-
ref: data.build.ref,
9-
path: data.repo.config_path
4+
let contents = data.yaml
5+
if (!contents) {
6+
const options = {
7+
user: data.repo.namespace,
8+
repo: data.repo.name,
9+
ref: data.build.ref,
10+
path: data.repo.config_path
11+
}
12+
const file = await promisify(gh.repos.getContent)(options)
13+
contents = Buffer.from(file.content, 'base64').toString()
1014
}
11-
file = await promisify(gh.repos.getContent)(options)
12-
const contents = Buffer.from(file.content, 'base64').toString()
1315
const parsed = yaml.parse(contents)
1416
return parsed
1517
}

plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ app.post('/', bodyParser.json(), async (req, res) => {
6565
res.json({ Data: returnYaml })
6666
})
6767

68-
app.listen(3000)
68+
app.listen(3000)

0 commit comments

Comments
 (0)