Skip to content

Commit f8bb3b3

Browse files
committed
🚚 Rename project to pull
1 parent 5dc1483 commit f8bb3b3

11 files changed

Lines changed: 97 additions & 628 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<img align="right" width="120" height="120" src="https://user-images.githubusercontent.com/5880908/40619990-2deb6502-6265-11e8-88c3-f2bcbac74a42.png" />
22

3-
# Sync Up
3+
# Pull
44

5-
[![TravisCI](https://travis-ci.com/wei/sync-up.svg?branch=master)](https://travis-ci.com/wei/sync-up)
6-
[![Codecov](https://codecov.io/gh/wei/sync-up/branch/master/graph/badge.svg)](https://codecov.io/gh/wei/sync-up)
7-
[![Depfu](https://badges.depfu.com/badges/74c85550f06d7840881eab5756738628/overview.svg)](https://depfu.com/github/wei/sync-up)
5+
[![TravisCI](https://travis-ci.com/wei/pull.svg?branch=master)](https://travis-ci.com/wei/pull)
6+
[![Codecov](https://codecov.io/gh/wei/pull/branch/master/graph/badge.svg)](https://codecov.io/gh/wei/pull)
7+
[![Depfu](https://badges.depfu.com/badges/4a6fdae34a957e6c1ac11a83f6491162/overview.svg)](https://depfu.com/github/wei/pull)
88
<br/>
99
[![Probot](https://img.shields.io/badge/built%20with-probot-orange.svg)](https://probot.github.io/)
1010
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
@@ -28,9 +28,9 @@ Recommended setup:
2828
1. Fork a repository
2929
2. Create a new branch
3030
3. Setup the new branch as Default branch under repository Settings > Branches
31-
4. Add `.github/sync-up.yml` to your default branch.
31+
4. Add `.github/pull.yml` to your default branch.
3232

33-
Most common `sync-up.xml`:
33+
Most common `pull.xml`:
3434
```yaml
3535
version: "1"
3636
rules:
@@ -43,7 +43,7 @@ rules:
4343
Explained:
4444
```yaml
4545
version: "1"
46-
rules: # Array of branches to sync
46+
rules: # Array of branches to pull
4747
- head: master # Required. Target local branch
4848
upstream: wei:master # Required. Must be in the same fork network.
4949
autoMerge: true # Optional, Default: false
@@ -54,11 +54,11 @@ rules: # Array of branches to sync
5454
- wei
5555
reviewers: # Optional
5656
- wei
57-
label: "sync-up :arrow_up_down:" # Optional
57+
label: "pull :arrow_down:" # Optional
5858
```
5959
60-
5. Go to `https://sync-up.now.sh/check/:owner/:repo` to validate your `sync-up.yml`.
61-
6. Install Sync Up app via https://github.com/apps/sync-up and select only the repos you wish to sync up.
60+
5. Go to `https://pull.now.sh/check/:owner/:repo` to validate your `pull.yml`.
61+
6. Install Pull app via https://github.com/apps/pull and select only the repos you wish to pull.
6262

6363

6464
## Author

‎index.js‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const SYNCUP_CONFIG = process.env.SYNCUP_CONFIG || 'sync-up.yml'
1+
const PULL_CONFIG = process.env.PULL_CONFIG || 'pull.yml'
22

33
const getConfig = require('probot-config')
44
const createScheduler = require('probot-scheduler')
55
const fetch = require('node-fetch')
66
const yaml = require('js-yaml')
77

8-
const SyncUp = require('./lib/sync-up')
8+
const Pull = require('./lib/pull')
99
const schema = require('./lib/schema')
1010

1111
module.exports = async (robot) => {
@@ -16,14 +16,14 @@ module.exports = async (robot) => {
1616
robot.on(['pull_request', 'pull_request_review'], checkPRStatus)
1717

1818
async function handlePush (context) {
19-
if (context.payload.commits.filter(c => c.message.indexOf(SYNCUP_CONFIG) > -1).length > 0) {
19+
if (context.payload.commits.filter(c => c.message.indexOf(PULL_CONFIG) > -1).length > 0) {
2020
await routineCheck(context)
2121
}
2222
}
2323

2424
async function routineCheck (context) {
25-
const syncUp = await forRepository(context)
26-
if (syncUp) await syncUp.routineCheck()
25+
const pull = await forRepository(context)
26+
if (pull) await pull.routineCheck()
2727
}
2828

2929
async function checkPRStatus (context) {
@@ -42,8 +42,8 @@ module.exports = async (robot) => {
4242
return
4343
}
4444

45-
const syncUp = await forRepository(context)
46-
if (syncUp) await syncUp.checkAutoMerge(context.payload.pull_request)
45+
const pull = await forRepository(context)
46+
if (pull) await pull.checkAutoMerge(context.payload.pull_request)
4747
}
4848

4949
async function forRepository (context) {
@@ -52,22 +52,22 @@ module.exports = async (robot) => {
5252
return null
5353
}
5454

55-
const config = await getConfig(context, SYNCUP_CONFIG)
55+
const config = await getConfig(context, PULL_CONFIG)
5656
if (!config) {
5757
scheduler.stop(context.payload.repository)
5858
return null
5959
}
6060

61-
return new SyncUp(context.github, context.repo({ logger: robot.log }), config)
61+
return new Pull(context.github, context.repo({ logger: robot.log }), config)
6262
}
6363

6464
const app = robot.route()
6565

66-
app.get('/', (req, res) => res.redirect('https://github.com/wei/sync-up#readme'))
66+
app.get('/', (req, res) => res.redirect('https://github.com/wei/pull#readme'))
6767

6868
app.get('/check/:owner/:repo', (req, res) => {
69-
robot.log.info(`[${req.params.owner}/${req.params.repo}] Checking ${SYNCUP_CONFIG}`)
70-
fetch(`https://api.github.com/repos/${req.params.owner}/${req.params.repo}/contents/.github/${SYNCUP_CONFIG}`)
69+
robot.log.info(`[${req.params.owner}/${req.params.repo}] Checking ${PULL_CONFIG}`)
70+
fetch(`https://api.github.com/repos/${req.params.owner}/${req.params.repo}/contents/.github/${PULL_CONFIG}`)
7171
.then(githubRes => githubRes.json())
7272
.then(json => Buffer.from(json.content, 'base64').toString())
7373
.then(yml => yaml.safeLoad(yml))

‎lib/helper.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
exports.timeout = ms => new Promise((resolve, reject) => setTimeout(resolve, ms))
22

33
exports.getPRTitle = (ref, upstream) =>
4-
`[sync-up] ${ref} from ${upstream}`
4+
`[pull] ${ref} from ${upstream}`
55

66
exports.getPRBody = (repoPath, prNumber) =>
77
(prNumber
8-
? `See [Commits](/${repoPath}/pull/${prNumber}/commits) and [Diffs](/${repoPath}/pull/${prNumber}/files) for more details.\n\n-----\nCreated by [sync-up](https://github.com/wei/sync-up)`
8+
? `See [Commits](/${repoPath}/pull/${prNumber}/commits) and [Diffs](/${repoPath}/pull/${prNumber}/files) for more details.\n\n-----\nCreated by [pull](https://github.com/wei/pull)`
99
: 'Processing...')

lib/sync-up.js renamed to lib/pull.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const schema = require('./schema')
22
const helper = require('./helper')
33

4-
module.exports = class SyncUp {
4+
module.exports = class Pull {
55
constructor (github, { owner, repo, logger = console }, config) {
66
this.github = github
77
this.logger = logger
@@ -46,7 +46,7 @@ module.exports = class SyncUp {
4646

4747
if (rule && rule.autoMerge &&
4848
incomingPR.state === 'open' &&
49-
incomingPR.user.login === 'sync-up[bot]' &&
49+
incomingPR.user.login === 'pull[bot]' &&
5050
incomingPR.mergeable !== false
5151
) {
5252
const mergable = incomingPR.mergeable_state === 'clean' ||
@@ -85,7 +85,7 @@ module.exports = class SyncUp {
8585

8686
async hasOpenPR (base) {
8787
const res = await this.github.search.issues({
88-
q: `repo:${this.config.repoPath} type:pr is:open base:${base} author:app/sync-up`,
88+
q: `repo:${this.config.repoPath} type:pr is:open base:${base} author:app/pull`,
8989
per_page: 1, // Cannot be 0 because it will fallback to default: 30
9090
page: 1
9191
})

‎lib/schema.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ruleSchema = Joi.object().keys({
3939
const schema = Joi.object().keys({
4040
version: fields.version.required(),
4141
rules: Joi.array().items(ruleSchema).min(1).unique().required(),
42-
label: fields.label.default('sync-up :arrow_up_down:')
42+
label: fields.label.default('pull :arrow_down:')
4343
}).options({ stripUnknown: true }).required()
4444

4545
module.exports = schema

‎now.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "sync-up",
3-
"alias": "sync-up.now.sh",
2+
"name": "pull",
3+
"alias": "pull.now.sh",
44
"type": "npm",
55
"env": {
66
"NODE_ENV": "production",
77
"LOG_LEVEL": "info",
8-
"APP_ID": "12711",
8+
"APP_ID": "12910",
99
"WEBHOOK_PATH": "/webhook"
1010
},
1111
"scale": {

0 commit comments

Comments
 (0)