Skip to content

Commit b3ed73c

Browse files
🎉 Init repo config from @koj-co/template
1 parent 366c442 commit b3ed73c

19 files changed

+8890
-3191
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"

.github/labeler.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
config:
2+
- ./*
3+
tooling:
4+
- tooling/**/*.*
5+
assets:
6+
- static/**/*.*
7+
tests:
8+
- any: ["src/**/*.spec.js", "cypress/**/*"]
9+
package:
10+
- any: ["package.json", "package-lock.json"]
11+
source:
12+
- src/**/*

.github/licensed.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sources:
2+
npm: true
3+
allowed:
4+
- apache-2.0
5+
- bsd-2-clause
6+
- bsd-3-clause
7+
- isc
8+
- mit
9+
- cc0-1.0
10+
- unlicense
11+
reviewed:
12+
npm:

.github/workflows/automerge.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Merge PRs
2+
on:
3+
pull_request:
4+
types:
5+
- labeled
6+
- synchronize
7+
- opened
8+
- edited
9+
- ready_for_review
10+
- reopened
11+
- unlocked
12+
pull_request_review:
13+
types:
14+
- submitted
15+
jobs:
16+
automerge:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Automerge
20+
uses: pascalgn/[email protected]
21+
env:
22+
GITHUB_TOKEN: "${{ secrets.GH_PAT }}"
23+
MERGE_LABELS: "merge,!work in progress,!wip"
24+
MERGE_REMOVE_LABELS: "merge"
25+
MERGE_METHOD: "merge"
26+
MERGE_COMMIT_MESSAGE: ":twisted_rightwards_arrows: Merge #{pullRequest.number} ({pullRequest.title})"
27+
MERGE_FORKS: false
28+
UPDATE_LABELS: "merge"
29+
UPDATE_METHOD: "merge"
30+
- name: Delete merged branch
31+
uses: koj-co/delete-merged-action@master
32+
with:
33+
branches: "!master, !production, *"
34+
env:
35+
GITHUB_TOKEN: "${{ secrets.GH_PAT }}"

.github/workflows/cla.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CLA Assistant
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened, closed, synchronize]
7+
jobs:
8+
claAssistant:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check signed CLA
12+
if: (github.event.comment.body == 'recheckcla' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
13+
uses: cla-assistant/github-action@master
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
16+
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PAT }}
17+
with:
18+
path-to-signatures: cla-signatures.json
19+
path-to-cla-document: https://github.com/koj-co/.github/blob/master/CLA.md
20+
allowlist: dependabot-preview[bot], dependabot[bot], greenkeeper[bot], *bot, bot*
21+
remote-organization-name: koj-co
22+
remote-repository-name: .github
23+
signed-commit-message: ":wrench: @$contributorName has signed the CLA in #$pullRequestNo"
24+
create-file-commit-message: ":wrench: Creating a file for storing CLA signatures"
25+
custom-allsigned-prcomment: "✍️ All contributors have signed the CLA"
26+
custom-notsigned-prcomment: "Thanks for your submission! We ask that $you sign our [Contributor License Agreement]($pathToCLADocument) before we can accept your contribution. You can sign the CLA by adding a comment below using this text:"

.github/workflows/feature-pr.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Feature Branch Pull Request
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
- production
7+
jobs:
8+
auto-pull-request:
9+
name: PullRequestAction
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Generate branch name
13+
uses: actions/github-script@v3
14+
id: set-branch-name
15+
with:
16+
script: |
17+
const capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
18+
const emoji = context.payload.ref.startsWith("refs/heads/feature")
19+
? "✨ "
20+
: context.payload.ref.startsWith("refs/heads/hotfix")
21+
? "🚑 "
22+
: "";
23+
return `${emoji}${capitalize(
24+
context.payload.ref
25+
.replace("refs/heads/", "")
26+
.replace(/-/g, " ")
27+
.replace("feature ", "")
28+
.replace("hotfix ", "")
29+
)}`;
30+
result-encoding: string
31+
- name: Set branch name
32+
run: echo "PULL_REQUEST_TITLE=${{steps.set-branch-name.outputs.result}}" >> $GITHUB_ENV
33+
- name: Generate PR body
34+
uses: actions/github-script@v3
35+
id: set-pr-body
36+
with:
37+
script: |
38+
return `I'm opening this pull request for this branch, pushed by @${
39+
context.payload.head_commit.author.username
40+
} with ${context.payload.commits.length} commit${
41+
context.payload.commits.length === 1 ? "" : "s"
42+
}.`;
43+
result-encoding: string
44+
- name: Set PR body
45+
run: echo "PULL_REQUEST_BODY=${{steps.set-pr-body.outputs.result}}" >> $GITHUB_ENV
46+
- name: pull-request-action
47+
uses: vsoch/[email protected]
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
50+
BRANCH_PREFIX: "feature-"
51+
PULL_REQUEST_BRANCH: "master"
52+
PULL_REQUEST_REVIEWERS: "AnandChowdhary"
53+
PULL_REQUEST_DRAFT: true

.github/workflows/hotfix-pr.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Hotfix Branch Pull Request
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
- production
7+
jobs:
8+
auto-pull-request:
9+
name: PullRequestAction
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Generate branch name
13+
uses: actions/github-script@v3
14+
id: set-branch-name
15+
with:
16+
script: |
17+
const capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
18+
const emoji = context.payload.ref.startsWith("refs/heads/feature")
19+
? "✨ "
20+
: context.payload.ref.startsWith("refs/heads/hotfix")
21+
? "🚑 "
22+
: "";
23+
return `${emoji}${capitalize(
24+
context.payload.ref
25+
.replace("refs/heads/", "")
26+
.replace(/-/g, " ")
27+
.replace("feature ", "")
28+
.replace("hotfix ", "")
29+
)}`;
30+
result-encoding: string
31+
- name: Set branch name
32+
run: echo "PULL_REQUEST_TITLE=${{steps.set-branch-name.outputs.result}}" >> $GITHUB_ENV
33+
- name: Generate PR body
34+
uses: actions/github-script@v3
35+
id: set-pr-body
36+
with:
37+
script: |
38+
return `I'm opening this pull request for this branch, pushed by @${
39+
context.payload.head_commit.author.username
40+
} with ${context.payload.commits.length} commit${
41+
context.payload.commits.length === 1 ? "" : "s"
42+
}.`;
43+
result-encoding: string
44+
- name: Set PR body
45+
run: echo "PULL_REQUEST_BODY=${{steps.set-pr-body.outputs.result}}" >> $GITHUB_ENV
46+
- name: pull-request-action
47+
uses: vsoch/[email protected]
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
50+
BRANCH_PREFIX: "hotfix-"
51+
PULL_REQUEST_BRANCH: "production"
52+
PULL_REQUEST_REVIEWERS: "AnandChowdhary"

.github/workflows/labeler.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Pull Request Labeler
2+
on:
3+
- pull_request
4+
- pull_request_review
5+
jobs:
6+
triage:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Label all PRs
10+
uses: actions/labeler@master
11+
with:
12+
repo-token: "${{ secrets.GH_PAT }}"
13+
- name: Label approved PRs
14+
uses: koj-co/label-approved-action@master
15+
with:
16+
labels: "merge"
17+
env:
18+
GITHUB_TOKEN: "${{ secrets.GH_PAT }}"

.github/workflows/licensed.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: License CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
name: Check licenses
10+
steps:
11+
- name: Checkout
12+
uses: actions/[email protected]
13+
- name: Setup license
14+
uses: jonabc/[email protected]
15+
with:
16+
version: 2.x
17+
- run: npm ci
18+
- id: licensed
19+
uses: jonabc/licensed-ci@v1
20+
with:
21+
config_file: .github/licensed.yml
22+
github_token: ${{ secrets.GH_PAT }}
23+
user_name: "KojBot"
24+
user_email: "[email protected]"
25+
commit_message: ":page_facing_up: Update dependency license file [skip ci]"
26+
- uses: actions/github-script@v3
27+
if: always() && steps.licensed.outputs.pr_number
28+
with:
29+
github-token: ${{ secrets.GH_PAT }}
30+
script: |
31+
github.issues.createComment({
32+
...context.repo,
33+
issue_number: ${{ steps.licensed.outputs.pr_number }}
34+
body: "I've checked the license of your new dependency and it looks good!"
35+
})

.github/workflows/node.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Node CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
release:
8+
name: Build, test, and release
9+
runs-on: ubuntu-18.04
10+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
- name: Setup Node.js
15+
uses: actions/[email protected]
16+
with:
17+
node-version: 14
18+
- name: Install dependencies
19+
run: npm ci
20+
- name: Build TypeScript
21+
run: npm run build
22+
- name: Run tests
23+
run: npm run test
24+
- name: Release
25+
run: npx semantic-release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
28+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29+
GIT_AUTHOR_NAME: "Koj Bot"
30+
GIT_AUTHOR_EMAIL: "[email protected]"
31+
GIT_COMMITTER_NAME: "Koj Bot"
32+
GIT_COMMITTER_EMAIL: "[email protected]"

.github/workflows/stale.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Stale Issues CI"
2+
on:
3+
schedule:
4+
- cron: "0 0 * * *"
5+
jobs:
6+
stale:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/stale@v3
10+
with:
11+
repo-token: ${{ secrets.GH_PAT }}
12+
stale-issue-message: "⚠️ This issue has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week."
13+
stale-pr-message: "⚠️ This PR has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week."
14+
days-before-stale: 60
15+
days-before-close: 7
16+
stale-issue-label: "wontfix"
17+
exempt-issue-labels: "wip"
18+
stale-pr-label: "wontfix"
19+
exempt-pr-labels: "wip"

.prettierrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@koj/config").prettier;

jest.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: "ts-jest",
3+
testEnvironment: "node",
4+
};

0 commit comments

Comments
 (0)