Skip to content

Commit

Permalink
feat: add colored logger
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Sep 27, 2024
1 parent 83c7897 commit ce62ea1
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 79 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/assign-author.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 🤖 PR author as an assignee
on:
pull_request:

jobs:
assign:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- uses: toshimaru/auto-author-assign@v2.1.1
if: env.IS_OWNER_MODE == 'true'
with:
repo-token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
53 changes: 53 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 🤖 PR auto merge
on:
pull_request:

env:
PR_JOBS_NAME: '[ "ci" ]'

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- id: jobs
run: |
if [[ "${{ env.IS_TAIGA_FAMILY_BOT_PR_AUTHOR }}" == "true" ]]; then
echo "value=$PR_JOBS_NAME" >> $GITHUB_OUTPUT
else
echo "value=[]" >> $GITHUB_OUTPUT
fi
outputs:
jobs: ${{ steps.jobs.outputs.value }}

wait:
needs: [setup]
runs-on: ubuntu-latest
strategy:
fail-fast: true
jobs:
value: ${{ fromJSON(needs.setup.outputs.jobs) }}
steps:
- uses: taiga-family/ci/actions/run/wait-job@v1.87.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: ${{ jobs.value }}

approve:
needs: [wait]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- uses: taiga-family/ci/actions/auto/approve/double@v1.87.5
with:
token1: ${{ secrets.GITHUB_TOKEN }}
token2: ${{ secrets.TAIGA_FAMILY_APPROVE_BOT_PAT }}
- uses: taiga-family/ci/actions/run/merge@v1.87.5
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.3
- uses: taiga-family/ci/actions/setup/node@v1.87.3
with:
persist-credentials: false
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- uses: taiga-family/ci/actions/setup/node@v1.87.5
- run: |
if [[ "${{ env.SUPPORT_AUTO_PUSH }}" == "true" ]]; then
npm run prettier -- --write
Expand All @@ -27,10 +29,10 @@ jobs:
npm run build
npm test
- uses: taiga-family/ci/actions/auto/push@v1.87.3
- uses: taiga-family/ci/actions/auto/push@v1.87.5
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
10 changes: 7 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.3
- uses: taiga-family/ci/actions/setup/node@v1.87.3
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- uses: taiga-family/ci/actions/setup/node@v1.87.5
- run: npm run build:demo
- uses: taiga-family/ci/actions/deploy/github-pages@v1.87.3
- uses: taiga-family/ci/actions/deploy/github-pages@v1.87.5
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}
folder: dist/apps/demo

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
68 changes: 0 additions & 68 deletions .github/workflows/pr.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/ready-to-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 🤖 PR is ready to merge
on:
pull_request_review:
types: [submitted]

jobs:
label-when-approved:
name: Label when approved
runs-on: ubuntu-latest
if: github.event.review.state == 'APPROVED'
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/setup/variables@v1.87.5
- uses: taiga-family/ci/actions/auto/label-when-approved@v1.87.5
with:
approvals: 1
token: ${{ secrets.GITHUB_TOKEN }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:
if: "!contains(github.event.head_commit.message, 'chore(release)')"
steps:
- uses: actions/checkout@v4.2.0
- uses: taiga-family/ci/actions/run/release-it@v1.87.3
- uses: taiga-family/ci/actions/run/release-it@v1.87.5
with:
ref: ${{ github.ref }}
mode: ${{ github.event.inputs.mode }}
npmToken: ${{ secrets.NPM_TOKEN }}
githubToken: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

- uses: taiga-family/ci/actions/run/read-package-json@v1.87.3
- uses: taiga-family/ci/actions/run/read-package-json@v1.87.5
id: info

- name: Announce to Telegram
uses: taiga-family/ci/actions/messenger/telegram/announce@v1.87.3
uses: taiga-family/ci/actions/messenger/telegram/announce@v1.87.5
with:
chatId: ${{ secrets.TAIGA_TELEGRAM_CHAT_ID }}
topicId: ${{ secrets.TAIGA_TELEGRAM_CHAT_THREAD_ID }}
Expand All @@ -40,5 +40,5 @@ jobs:
textLink: ${{ steps.info.outputs.name }}

concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
26 changes: 26 additions & 0 deletions libs/ng-morph/src/utils/colored-log.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export function processLog(message: string): void {
console.info('\x1B[36m%s\x1B[0m', message);
}

export function errorLog(message: string): void {
console.info('\x1B[31m%s\x1B[0m', message);
}

export function successLog(message: string): void {
console.info('\x1B[32m%s\x1B[0m', message);
}

export function infoLog(message: string): void {
console.info('\x1B[34m%s\x1B[0m', message);
}

export function titleLog(message: string): void {
console.info('\x1B[35m', message);
}

export const SMALL_TAB_SYMBOL = ' '; // @note: if you use \t then we have big gaps
export const START_SYMBOL = '🚀';
export const FINISH_SYMBOL = '🏆';
export const REPLACE_SYMBOL = '⚡️';
export const PROCESSING_SYMBOL = '> ';
export const SUCCESS_SYMBOL = '✅ ';
1 change: 1 addition & 0 deletions libs/ng-morph/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './array-flat';
export * from './coerce-array';
export * from './colored-log';
export * from './filter-primitive';
export * from './get-declaration-creator';
export * from './get-declaration-editor';
Expand Down

0 comments on commit ce62ea1

Please sign in to comment.