chore: ts config is stable now the package will be available in cjs a… #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches-ignore: | |
- 'master' | |
jobs: | |
lint: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: User Node.js LTS | |
uses: actions/setup-node@v2 | |
- name: Install pnpm | |
uses: pnpm/[email protected] | |
with: | |
run_install: false | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Lint | |
run: pnpm run lint | |
- name: Linter Failed | |
if: ${{ failure() }} | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const { pullRequestData: data } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: context.payload.after | |
}) | |
if(pullRequestData[0]){ | |
await github.rest.issues.createComment({ | |
issue_number: pullRequestData[0].number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `### 🚨 Linter failed` | |
}) | |
} else { | |
throw new Error('Pull request data not found') | |
} | |
build: | |
runs-on: ubuntu-latest | |
needs: [lint] | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build the packages | |
run: pnpm build | |
- name: Build Success | |
if: ${{ success() }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require("fs") | |
const path = require("path") | |
const { data: pullRequestData } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: context.payload.after | |
}) | |
if(pullRequestData[0]){ | |
await github.rest.issues.createComment({ | |
issue_number: pullRequestData[0].number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `#### 🟢 Build success` | |
}) | |
} else { | |
throw new Error('Pull request data not found') | |
} | |
- name: Build Failed | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { data: pullRequestData } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: context.payload.after | |
}) | |
if(pullRequestData[0]){ | |
await github.rest.issues.createComment({ | |
issue_number: pullRequestData[0].number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `#### ❌ Build failed: | |
` | |
}) | |
} else { | |
throw new Error('Pull request data not found') | |
} |