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

Replace probot-config with context.config #49

Open
wants to merge 3 commits into
base: master
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
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const getComment = require('./lib/getComment')
const defaultConfig = require('./lib/defaultConfig')
const PullRequestBodyChecker = require('./lib/PullRequestBodyChecker')
const IssueBodyChecker = require('./lib/IssueBodyChecker')
const getConfig = require('probot-config')

module.exports = app => {
app.on('installation_repositories.added', learningLabWelcome)
Expand All @@ -23,7 +22,7 @@ module.exports = app => {
}

try {
const config = await getConfig(context, 'config.yml', defaultConfig)
const config = await context.config(`config.yml`, defaultConfig)

if (!config.requestInfoOn[eventSrc]) {
return
Expand Down
4 changes: 2 additions & 2 deletions lib/IssueBodyChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function fromBase64 (content) {

async function getIssueTemplateBody (context, path) {
try {
const singleTemplate = await context.github.repos.getContent(
const singleTemplate = await context.github.repos.getContents(
context.repo({ path })
)

Expand All @@ -16,7 +16,7 @@ async function getIssueTemplateBody (context, path) {

async function getIssueTemplatePaths (context) {
try {
const templatesDirectory = await context.github.repos.getContent(
const templatesDirectory = await context.github.repos.getContents(
context.repo({ path: '.github/ISSUE_TEMPLATE/' })
)
return templatesDirectory.data.map(f => f.path)
Expand Down
2 changes: 1 addition & 1 deletion lib/PullRequestBodyChecker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
async function getPullRequestTemplate (context) {
const result = await context.github.repos.getContent({
const result = await context.github.repos.getContents({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
path: '.github/PULL_REQUEST_TEMPLATE.md'
Expand Down
3,773 changes: 2,351 additions & 1,422 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"npm": ">= 5.3.0"
},
"dependencies": {
"probot": "^7.2.0",
"probot-config": "^0.2.0"
"probot": "^9.3.0"
}
}
2 changes: 1 addition & 1 deletion test/events/issueFirstTemplateBodyEvent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"event": "issues",
"name": "issues",
"payload": {
"action": "opened",
"issue": {
Expand Down
2 changes: 1 addition & 1 deletion test/events/issueSecondTemplateBodyEvent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"event": "issues",
"name": "issues",
"payload": {
"action": "opened",
"issue": {
Expand Down
2 changes: 1 addition & 1 deletion test/events/issueTemplateBodyEvent.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"event": "issues",
"name": "issues",
"payload": {
"action": "opened",
"issue": {
Expand Down
Loading