Skip to content

Commit

Permalink
⬆️ Update koj-co/github-actions-starter
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 17, 2020
1 parent 05062d8 commit 1ee77ba
Show file tree
Hide file tree
Showing 15 changed files with 193 additions and 77 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_PAT }}
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 14
- 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
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/cla.yml

This file was deleted.

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/[email protected]
- name: Setup Node.js
uses: actions/[email protected]
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
9 changes: 4 additions & 5 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Dependabot PR CI
on:
schedule:
- cron: "0 * * * *"
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
label-approve:
Expand All @@ -10,7 +10,6 @@ jobs:
steps:
- uses: koj-co/dependabot-pr-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
approve-minor: true
approve-patch: true
auto-label: true
token: ${{ secrets.GH_PAT }}
merge-minor: true
merge-patch: true
20 changes: 0 additions & 20 deletions .github/workflows/feature-pr.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/hotfix-pr.yml

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2.3.4
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 12
- 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
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: PR Generator CI
on:
push:
branches-ignore:
- master
- production
jobs:
auto-pull-request:
name: PullRequestAction
runs-on: ubuntu-latest
steps:
- name: Generate branch name
uses: actions/github-script@v3
id: set-branch-name
with:
script: |
const capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
const emoji = context.payload.ref.startsWith("refs/heads/feature")
? "✨ "
: 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
- name: Set branch name
run: echo "PULL_REQUEST_TITLE=${{steps.set-branch-name.outputs.result}}" >> $GITHUB_ENV
- name: Generate PR body
uses: actions/github-script@v3
id: set-pr-body
with:
script: |
return `I'm opening this pull request for this branch, pushed by @${
context.payload.head_commit.author.username
} with ${context.payload.commits.length} commit${
context.payload.commits.length === 1 ? "" : "s"
}.`;
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/[email protected]
if: always() && steps.should-pr.outputs.result
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
PULL_REQUEST_BRANCH: "master"
PULL_REQUEST_REVIEWERS: "AnandChowdhary"
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 }}
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ jobs:
if: "contains(github.event.head_commit.message, 'Deploy new version')"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_PAT }}
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 14
- 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: Release
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Stale Issues CI"
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GH_PAT }}
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."
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."
days-before-stale: 60
days-before-close: 7
stale-issue-label: "wontfix"
exempt-issue-labels: "wip"
stale-pr-label: "wontfix"
exempt-pr-labels: "wip"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: "contains(github.event.head_commit.message, 'Deploy new version')"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
- uses: ./
with:
milliseconds: 1000
Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
.licenses
.github
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
8 changes: 5 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
"module": "commonjs",
"lib": ["dom", "esnext"],
"strict": true,
"sourceMap": false,
"declaration": false,
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declarationDir": "./dist",
"outDir": "./dist",
"typeRoots": ["node_modules/@types", "@types"]
},
"include": ["src"],
"include": ["src", "tooling"],
"exclude": ["node_modules"]
}

0 comments on commit 1ee77ba

Please sign in to comment.