Skip to content

Commit

Permalink
doc(readme): Update about part (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
deuzu authored Apr 10, 2021
1 parent 1742ed4 commit 92e4fd4
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 14 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h3 align="center">Github Democrat Action</h3>

<p align="center">
Enforce democracy on a repository by merging pull requests by voting score.
Enforce democracy on a project by allowing a community to vote for mergeable pull requests.
<br />
<a href="https://github.com/deuzu/github-democrat-action/"><strong>Explore the docs »</strong></a>
<br />
Expand All @@ -33,6 +33,22 @@

## About The Project

Have you ever been frustated that your open source contribution never gets merged?
Or that you missed a contribution on one of your project because you were not available?
I have...

Maintainers and contributors schedules are not synchronised. Manage or contribute to open source takes time.
Open source management and contribution are often done on your free time, and you want it as smooth as possible.
And you want the open source community to be as open as it should.

That's when I knew open source community needed democracy!
GNU defines a "free software" so that we can run, study, redistribute and distrubute modified copies.
What if , as an open source enthousiasts, you could vote to express your opinion on a project?

The Github Democrat brings democracy to a project.
It gives contributors and non-contributors another way to participate by voting.
The world is more than ever in the need of strong democracy enthousiasts. And so is the open source community.

### Built With

* [Node](https://nodejs.org)
Expand Down Expand Up @@ -62,7 +78,7 @@ jobs:
githubToken: ${{ secrets.GITHUB_TOKEN }} # GitHub automatically creates the GITHUB_TOKEN secret
# dryRun: true
# prMinimumReviewScore: 1
# prMaturity: 24
# prVotingTimeHours: 24
# prMarkAsMegeableLabel: ready
# prTargetBranch: main
```
Expand Down
4 changes: 2 additions & 2 deletions __tests__/democrat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Democrat', () => {
const democratParameters = { token: '12345abc', owner: 'org', repo: 'repo', dryRun: false, logFunction: () => {} }
const pullRequestParameters = {
minimumReviewScore: 1,
maturity: 24,
votingTimeHours: 24,
markAsMergeableLabel: 'ready',
targetBranch: 'main',
}
Expand All @@ -55,7 +55,7 @@ describe('Democrat', () => {
const democratParameters = { token: '12345abc', owner: 'org', repo: 'repo', dryRun: true, logFunction: () => {} }
const pullRequestParameters = {
minimumReviewScore: 1,
maturity: 24,
votingTimeHours: 24,
markAsMergeableLabel: 'ready',
targetBranch: 'main',
}
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ inputs:
required: false
description: The minimum pull request review score needed to be eligible for merge (approves +1, request changes -1)
default: 1
prMaturity:
prVotingTimeHours:
required: false
description: The delay (in hours) needed before a pull request is eligible for merge
description: The delay (in hours and since the last commit) needed before a pull request is eligible for merge
default: 24
prMarkAsMegeableLabel:
required: false
Expand Down
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/democrat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface DemocratParameters {

export interface PullRequestParameters {
readonly minimumReviewScore: number
readonly maturity: number
readonly votingTimeHours: number
readonly markAsMergeableLabel: string
readonly targetBranch: string
}
Expand Down Expand Up @@ -161,13 +161,13 @@ export default class Democrat {

private validatePullCandidate(pullCandidate: PullCandidate): string[] {
const errors = []
const { minimumReviewScore, maturity, markAsMergeableLabel, targetBranch } = this.pullRequestParameters
const { minimumReviewScore, votingTimeHours, markAsMergeableLabel, targetBranch } = this.pullRequestParameters
const lastCommitSinceHours = (+new Date() - pullCandidate.updatedAt.getTime()) / (1000 * 60 * 60)
const hasMergeableLabel = -1 !== pullCandidate.labels.indexOf(markAsMergeableLabel)

pullCandidate.mergeable || errors.push('not mergeable')
pullCandidate.reviewScore >= minimumReviewScore || errors.push(`review score too low: ${pullCandidate.reviewScore}`)
lastCommitSinceHours > maturity ||
lastCommitSinceHours > votingTimeHours ||
errors.push(`not mature enough (last commit ${lastCommitSinceHours.toPrecision(1)}h ago)`)
hasMergeableLabel || errors.push(`missing \`${markAsMergeableLabel}\` label`)
targetBranch === pullCandidate.base ||
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function run(): Promise<void> {

const pullRequestParameters: PullRequestParameters = {
minimumReviewScore: parseInt(core.getInput('prMinimumReviewScore') || process.env.PR_MINIMUM_REVIEW_SCORE || ''),
maturity: parseInt(core.getInput('prMaturity') || process.env.PR_MATURITY || ''),
votingTimeHours: parseInt(core.getInput('prVotingTimeHours') || process.env.PR_VOTING_TIME_HOURS || ''),
markAsMergeableLabel: core.getInput('prMarkAsMegeableLabel') || process.env.PR_MARK_AS_MERGEABLE_LABEL || '',
targetBranch: core.getInput('prTargetBranch') || process.env.PR_TARGET_BRANCH || '',
}
Expand Down

0 comments on commit 92e4fd4

Please sign in to comment.