Skip to content

Commit 2cfefd3

Browse files
committed
first commit
1 parent aad04f6 commit 2cfefd3

15 files changed

+8676
-0
lines changed

.env.example

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The ID of your GitHub App
2+
APP_ID=
3+
WEBHOOK_SECRET=development
4+
5+
# Use `trace` to get verbose logging or `info` to show less
6+
LOG_LEVEL=debug
7+
8+
# Go to https://smee.io/new set this to the URL that you are redirected to.
9+
WEBHOOK_PROXY_URL=

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "./script/kcdata-gen"]
2+
path = ./script/kcdata-gen
3+
url = https://github.com/Gizeta/kcdata-gen.git

CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
education, socio-economic status, nationality, personal appearance, race,
10+
religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+

CONTRIBUTING.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Contributing
2+
3+
[fork]: /fork
4+
[pr]: /compare
5+
[style]: https://standardjs.com/
6+
[code-of-conduct]: CODE_OF_CONDUCT.md
7+
8+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
9+
10+
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
11+
12+
## Issues and PRs
13+
14+
If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them.
15+
16+
We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR.
17+
18+
## Submitting a pull request
19+
20+
1. [Fork][fork] and clone the repository.
21+
1. Configure and install the dependencies: `npm install`.
22+
1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so there's no need to lint separately.
23+
1. Create a new branch: `git checkout -b my-branch-name`.
24+
1. Make your change, add tests, and make sure the tests still pass.
25+
1. Push to your fork and [submit a pull request][pr].
26+
1. Pat your self on the back and wait for your pull request to be reviewed and merged.
27+
28+
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
29+
30+
- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`.
31+
- Write and update tests.
32+
- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
33+
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
34+
35+
Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you.
36+
37+
## Resources
38+
39+
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
40+
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
41+
- [GitHub Help](https://help.github.com)

LICENSE

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2019, Gizeta <[email protected]> (http://kcwikizh.github.io/kcdata)
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# kcdata-bot
2+
3+
> A GitHub App built with [Probot](https://github.com/probot/probot) that A Github bot to manage kcdata repo
4+
5+
## Setup
6+
7+
```sh
8+
# Install dependencies
9+
npm install
10+
11+
# Run the bot
12+
npm start
13+
```
14+
15+
## Contributing
16+
17+
If you have suggestions for how kcdata-bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
18+
19+
For more, check out the [Contributing Guide](CONTRIBUTING.md).
20+
21+
## License
22+
23+
[ISC](LICENSE) © 2019 Gizeta <[email protected]> (http://kcwikizh.github.io/kcdata)

app.yml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# This is a GitHub App Manifest. These settings will be used by default when
2+
# initially configuring your GitHub App.
3+
#
4+
# NOTE: changing this file will not update your GitHub App settings.
5+
# You must visit github.com/settings/apps/your-app-name to edit them.
6+
#
7+
# Read more about configuring your GitHub App:
8+
# https://probot.github.io/docs/development/#configuring-a-github-app
9+
#
10+
# Read more about GitHub App Manifests:
11+
# https://developer.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/
12+
13+
# The list of events the GitHub App subscribes to.
14+
# Uncomment the event names below to enable them.
15+
default_events:
16+
# - check_run
17+
# - check_suite
18+
# - commit_comment
19+
# - create
20+
# - delete
21+
# - deployment
22+
# - deployment_status
23+
# - fork
24+
# - gollum
25+
# - issue_comment
26+
- issues
27+
# - label
28+
# - milestone
29+
# - member
30+
# - membership
31+
# - org_block
32+
# - organization
33+
# - page_build
34+
# - project
35+
# - project_card
36+
# - project_column
37+
# - public
38+
# - pull_request
39+
# - pull_request_review
40+
# - pull_request_review_comment
41+
# - push
42+
# - release
43+
# - repository
44+
# - repository_import
45+
# - status
46+
# - team
47+
# - team_add
48+
# - watch
49+
50+
# The set of permissions needed by the GitHub App. The format of the object uses
51+
# the permission name for the key (for example, issues) and the access type for
52+
# the value (for example, write).
53+
# Valid values are `read`, `write`, and `none`
54+
default_permissions:
55+
# Repository creation, deletion, settings, teams, and collaborators.
56+
# https://developer.github.com/v3/apps/permissions/#permission-on-administration
57+
# administration: read
58+
59+
# Checks on code.
60+
# https://developer.github.com/v3/apps/permissions/#permission-on-checks
61+
# checks: read
62+
63+
# Repository contents, commits, branches, downloads, releases, and merges.
64+
# https://developer.github.com/v3/apps/permissions/#permission-on-contents
65+
# contents: read
66+
67+
# Deployments and deployment statuses.
68+
# https://developer.github.com/v3/apps/permissions/#permission-on-deployments
69+
# deployments: read
70+
71+
# Issues and related comments, assignees, labels, and milestones.
72+
# https://developer.github.com/v3/apps/permissions/#permission-on-issues
73+
issues: write
74+
75+
# Search repositories, list collaborators, and access repository metadata.
76+
# https://developer.github.com/v3/apps/permissions/#metadata-permissions
77+
metadata: read
78+
79+
# Retrieve Pages statuses, configuration, and builds, as well as create new builds.
80+
# https://developer.github.com/v3/apps/permissions/#permission-on-pages
81+
# pages: read
82+
83+
# Pull requests and related comments, assignees, labels, milestones, and merges.
84+
# https://developer.github.com/v3/apps/permissions/#permission-on-pull-requests
85+
# pull_requests: read
86+
87+
# Manage the post-receive hooks for a repository.
88+
# https://developer.github.com/v3/apps/permissions/#permission-on-repository-hooks
89+
# repository_hooks: read
90+
91+
# Manage repository projects, columns, and cards.
92+
# https://developer.github.com/v3/apps/permissions/#permission-on-repository-projects
93+
# repository_projects: read
94+
95+
# Retrieve security vulnerability alerts.
96+
# https://developer.github.com/v4/object/repositoryvulnerabilityalert/
97+
# vulnerability_alerts: read
98+
99+
# Commit statuses.
100+
# https://developer.github.com/v3/apps/permissions/#permission-on-statuses
101+
# statuses: read
102+
103+
# Organization members and teams.
104+
# https://developer.github.com/v3/apps/permissions/#permission-on-members
105+
# members: read
106+
107+
# View and manage users blocked by the organization.
108+
# https://developer.github.com/v3/apps/permissions/#permission-on-organization-user-blocking
109+
# organization_user_blocking: read
110+
111+
# Manage organization projects, columns, and cards.
112+
# https://developer.github.com/v3/apps/permissions/#permission-on-organization-projects
113+
# organization_projects: read
114+
115+
# Manage team discussions and related comments.
116+
# https://developer.github.com/v3/apps/permissions/#permission-on-team-discussions
117+
# team_discussions: read
118+
119+
# Manage the post-receive hooks for an organization.
120+
# https://developer.github.com/v3/apps/permissions/#permission-on-organization-hooks
121+
# organization_hooks: read
122+
123+
# Get notified of, and update, content references.
124+
# https://developer.github.com/v3/apps/permissions/
125+
# organization_administration: read
126+
127+
128+
# The name of the GitHub App. Defaults to the name specified in package.json
129+
# name: My Probot App
130+
131+
# The homepage of your GitHub App.
132+
# url: https://example.com/
133+
134+
# A description of the GitHub App.
135+
# description: A description of my awesome app
136+
137+
# Set to true when your GitHub App is available to the public or false when it is only accessible to the owner of the app.
138+
# Default: true
139+
# public: false

index.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { exec } = require('child_process')
2+
3+
module.exports = app => {
4+
app.log('kcdata-bot started!')
5+
6+
app.on('issues.labeled', async context => {
7+
const { number } = context.payload.issue
8+
const triggered = context.payload.issue.labels.some(label => label.name === 'bot/update')
9+
if (!triggered) return
10+
11+
exec(`sh ./script/run.sh ${number}`, (err) => {
12+
if (err) {
13+
console.error(err)
14+
return
15+
}
16+
const pr = context.github.pulls.create({
17+
owner: 'kcwikizh',
18+
repo: 'kcdata',
19+
head: `bot-update-${number}`,
20+
base: 'gh-pages',
21+
maintainer_can_modify: true,
22+
title: 'Update data by kcdata-bot',
23+
body: `Triggered by #${number}\nMerge 前请务必检查内容是否填写完整。(例如:wiki_id是否填写完全)`
24+
})
25+
const issueComment = context.issue({ body: 'Done.' })
26+
return context.github.issues.createComment(issueComment)
27+
})
28+
})
29+
}

0 commit comments

Comments
 (0)