Skip to content

Commit

Permalink
⬆️ Update koj-co/template
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 17, 2020
1 parent 45893e6 commit ac4e767
Show file tree
Hide file tree
Showing 12 changed files with 154 additions and 94 deletions.
1 change: 1 addition & 0 deletions .github/licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ allowed:
- mit
- cc0-1.0
- unlicense
- 0bsd
reviewed:
npm:
- color-convert
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PAT }}
with:
path-to-signatures: cla-signatures.json
path-to-cla-document: https://github.com/koj-co/.github/blob/master/CLA.md
path-to-document: https://github.com/koj-co/.github/blob/master/CLA.md
allowlist: dependabot-preview[bot], dependabot[bot], greenkeeper[bot], *bot, bot*
remote-organization-name: koj-co
remote-repository-name: .github
signed-commit-message: ":wrench: @$contributorName has signed the CLA in #$pullRequestNo"
create-file-commit-message: ":wrench: Creating a file for storing CLA signatures"
signed-commit-message: ":wrench: @$contributorName has signed the CLA in #$pullRequestNo"
custom-allsigned-prcomment: "✍️ All contributors have signed the CLA"
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:"
custom-notsigned-prcomment: "Thanks for your submission! We ask that $you sign our [Contributor License Agreement](https://github.com/koj-co/.github/blob/master/CLA.md) before we can accept your contribution. You can sign the CLA by adding a comment below using this text:"
35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CodeQL CI
on:
schedule:
- cron: '0 0 * * 1'
jobs:
release:
name: Build and analyze
runs-on: ubuntu-18.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/setup-node@v2.1.2
with:
node-version: 14
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
15 changes: 15 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Dependabot PR CI
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
label-approve:
name: Label and approve minor/patch updates
runs-on: ubuntu-18.04
steps:
- uses: koj-co/dependabot-pr-action@master
with:
token: ${{ secrets.GH_PAT }}
merge-minor: true
merge-patch: true
52 changes: 0 additions & 52 deletions .github/workflows/hotfix-pr.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/licensed.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,25 @@ jobs:
uses: actions/setup-node@v2.1.2
with:
node-version: 14
- name: Setup Licensed
uses: jonabc/setup-licensed@v1.0.1
with:
version: 2.x
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Run tests
run: npm run test
- name: Release
Expand All @@ -28,3 +45,23 @@ jobs:
GIT_AUTHOR_EMAIL: "bot@koj.co"
GIT_COMMITTER_NAME: "Koj Bot"
GIT_COMMITTER_EMAIL: "bot@koj.co"
- name: Check dependency licenses
id: licensed
uses: jonabc/licensed-ci@v1
with:
config_file: .github/licensed.yml
github_token: ${{ secrets.GH_PAT }}
user_name: "KojBot"
user_email: "bot@koj.co"
commit_message: ":page_facing_up: Update dependency license file [skip ci]"
- name: Add PR comment
uses: actions/github-script@v3
if: always() && steps.licensed.outputs.pr_number
with:
github-token: ${{ secrets.GH_PAT }}
script: |
github.issues.createComment({
...context.repo,
issue_number: ${{ steps.licensed.outputs.pr_number }}
body: "I've checked the license of your new dependency and it looks good!"
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Feature Branch Pull Request
name: PR Generator CI
on:
push:
branches-ignore:
Expand All @@ -19,12 +19,15 @@ jobs:
? "✨ "
: context.payload.ref.startsWith("refs/heads/hotfix")
? "🚑 "
: context.payload.ref.startsWith("refs/heads/bug")
? "🐛 "
: "";
return `${emoji}${capitalize(
context.payload.ref
.replace("refs/heads/", "")
.replace(/-/g, " ")
.replace("feature ", "")
.replace("bug ", "")
.replace("hotfix ", "")
)}`;
result-encoding: string
Expand All @@ -43,11 +46,28 @@ jobs:
result-encoding: string
- name: Set PR body
run: echo "PULL_REQUEST_BODY=${{steps.set-pr-body.outputs.result}}" >> $GITHUB_ENV
- name: Generate PR draft
uses: actions/github-script@v3
id: set-pr-draft
with:
script: |
return !context.payload.ref.startsWith("refs/heads/hotfix");
- name: Set PR draft
run: echo "PULL_REQUEST_DRAFT=${{steps.set-pr-draft.outputs.result}}" >> $GITHUB_ENV
- name: Determine whether to merge
uses: actions/github-script@v3
id: should-pr
with:
github-token: ${{ secrets.GH_PAT }}
script: |
return
context.payload.ref.startsWith("refs/heads/feature") ||
context.payload.ref.startsWith("refs/heads/hotfix") ||
context.payload.ref.startsWith("refs/heads/bug");
- name: pull-request-action
uses: vsoch/pull-request-action@1.0.11
if: always() && steps.should-pr.outputs.result
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
BRANCH_PREFIX: "feature-"
PULL_REQUEST_BRANCH: "master"
PULL_REQUEST_REVIEWERS: "AnandChowdhary"
PULL_REQUEST_DRAFT: true
13 changes: 13 additions & 0 deletions .github/workflows/release-scheduler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release Scheduler CI
on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
jobs:
releaseScheduler:
runs-on: ubuntu-latest
steps:
- name: Run release-scheduler
uses: koj-co/release-scheduler@master
env:
GH_PAT: ${{ secrets.GH_PAT }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test CI
on:
push:
branches-ignore:
- master
jobs:
release:
name: Build and test
runs-on: ubuntu-18.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/setup-node@v2.1.2
with:
node-version: 14
- name: Install dependencies
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Run tests
run: npm run test
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
.licenses
.github
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"outDir": "./dist",
"typeRoots": ["node_modules/@types", "@types"]
},
"include": ["src", "tooling", "tests"],
"include": ["src", "tooling"],
"exclude": ["node_modules"]
}

0 comments on commit ac4e767

Please sign in to comment.