Skip to content

Commit

Permalink
BREAKING CHANGE: transfer repository to hakadoriya organization
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent committed Jan 5, 2025
1 parent 8a729dd commit 352fa53
Show file tree
Hide file tree
Showing 17 changed files with 925 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ref: https://docs.github.com/ja/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners
* @hakadoriya/owner
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "11:00"
timezone: "Asia/Tokyo"
commit-message:
prefix: "ci(github-actions): "
labels:
- "ci"
assignees:
- "hakadoriya/owner"
reviewers:
- "hakadoriya/owner"
groups:
dependencies:
patterns:
- "*"
29 changes: 29 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- markdownlint-disable MD004 MD041 -->

## Ticket / Issue Number

> **Note**
> *Please fill in the ticket or issue number.*
> > Example:
> >
> > #1
## What's changed

> **Note**
> *Please explain what changes this pull request will make.*
> > Example:
> >
> > - Added functionality to perform 'bar' on 'foo'.
## Check List

- [ ] Assign labels
- [ ] Add appropriate test cases

## Remark

> **Note**
> *Please provide additional remarks if necessary.*
<!-- markdownlint-enable MD004 MD041 -->
23 changes: 23 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: auto-assign

on:
pull_request:
types:
- opened
- ready_for_review
- reopened

jobs:
auto-assign:
name: Auto Assign
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- if: ${{ toJSON(github.event.pull_request.assignees) == '[]' }}
run: gh pr edit "${NUMBER}" --add-assignee "${ASSIGNEE}"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
ASSIGNEE: ${{ github.event.pull_request.user.login }}
80 changes: 80 additions & 0 deletions .github/workflows/label-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: label-checker

# Dependabot
# gh label create --force "dependencies" --description "Pull requests that update a dependency file" --color 0366D6
# gh label create --force "go" --description "Pull requests that update Go code" --color 16E2E2
# gh label create --force "github_actions" --description "Pull requests that update GitHub Actions code" --color 000000
# gh label create --force "docker" --description "Pull requests that update Docker code" --color 21CEFF

# Renovate
# gh label create --force "renovate" --description "Renovate" --color 009485

# Commit prefix
# gh label create --force "BREAKING CHANGE" --description "BREAKING CHANGES" --color FF0303
# gh label create --force "build" --description "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)" --color 5319E7
# gh label create --force "ci" --description "Changes to our CI configuration files and scripts (examples: CircleCi, SauceLabs)" --color 53C4EE
# gh label create --force "docs" --description "Documentation only changes" --color 1B3E44
# gh label create --force "feat" --description "A new feature" --color 0EAA80
# gh label create --force "fix" --description "A bug fix" --color 1D76DB
# gh label create --force "perf" --description "A code change that improves performance" --color A2EEEF
# gh label create --force "refactor" --description "A code change that neither fixes a bug nor adds a feature" --color C5DEF5
# gh label create --force "test" --description "Adding missing tests or correcting existing tests" --color 1D76DB
# gh label create --force "chore" --description "Changes to the build process or auxiliary tools and libraries such as documentation generation" --color 20313F

on:
pull_request:
types:
- opened
- edited
- labeled
- unlabeled
- ready_for_review
- reopened
- synchronize

env:
LABELS: "BREAKING CHANGE,build,ci,docs,feat,fix,perf,refactor,test,chore"

jobs:
label-checker:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
id-token: write
contents: read
pull-requests: write # required to add labels
statuses: read
checks: read
repository-projects: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }} # needed for gh pr view
- name: Check labels
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Check labels
set -Eeuo pipefail -x
# If any of the labels are present, exit with success
if [[ -n "$(gh pr view --json labels --jq ".labels[].name" | grep -E "^($(tr , "|" <<<"${LABELS:?}"))$")" ]]; then
exit 0
fi
# Add labels based on PR title
GH_PR_TITLE=$(gh pr view --json title --jq .title)
gh label list --json name --jq ".[].name" | while read -r LINE; do
awk -F: "/^${LINE-}(\([^\)]+\))?:/ {print \$1}" <<<"${GH_PR_TITLE:?}" | grep -Eo "^${LINE:?}" || true # NOTE: Ignore the return value of grep because we just want to output the string
done | xargs -t -I{} gh pr edit --add-label {}
# If any of the labels are present, exit with success
while read -r LINE; do
if grep -E "^($(tr , "|" <<<"${LABELS:?}"))$" <<<"${LINE-}"; then
exit 0
fi
done <<<"$(gh pr view --json labels --jq ".labels[].name")"
# If none of the labels are present, exit with error
exit 1
27 changes: 8 additions & 19 deletions .github/workflows/sh-test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
name: sh-test
# ~~~~~~~
# https://github.com/kunitsucom/log.sh/workflows/sh-test/badge.svg
# ~~~~~~~
# ^^^^^^^
# https://github.com/organization/repository/workflows/sh-test/badge.svg
# ^^^^^^^

on:
push:
branches:
- main
paths-ignore:
- '.github/dependabot.yml'
- '.github/pull_request_template.md'
- '.github/release.yml'
- 'README.md'
# NO paths-ignore
pull_request:
paths-ignore:
- '.github/dependabot.yml'
- '.github/pull_request_template.md'
- '.github/release.yml'
- 'README.md'
# NO paths-ignore
workflow_dispatch:
inputs: {}

# NOTE: 連続で commit & push した時に最新の commit 以外のワークフローをキャンセルする
# NOTE: Cancel the previous run of the same workflow if it's still running
concurrency:
group: ${{ github.workflow }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -41,7 +30,7 @@ jobs:
sh-test: # NOTE: for Branch protection rule `Status checks that are required.`
runs-on: ubuntu-latest # ref. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: DEBUG
run: |
cat <<'DEBUG_DOC'
Expand All @@ -58,4 +47,4 @@ jobs:
- name: Run test.sh
working-directory: ${{ env.WORKDIR }}
run: |
${{ env.WORKDIR }}/test.sh
${{ env.WORKDIR }}/bin/test.sh
22 changes: 22 additions & 0 deletions .github/workflows/task-list-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: task-list-checker

on:
pull_request:
types:
- opened
- edited
- ready_for_review
- reopened
- synchronize

jobs:
task-list-checker:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pull-requests: read
steps:
- uses: hakadoriya/github-actions-task-list-checker@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/typo-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: typo-checker
# ^^^^^^^^^^^^
# https://github.com/organization/repository/workflows/typo-checker/badge.svg
# ^^^^^^^^^^^^

on:
pull_request:
workflow_dispatch:
inputs: {}

# NOTE: If commit & push continuously, cancel the workflow other than the latest commit.
concurrency:
group: ${{ github.workflow }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write
contents: read

env:
WORKDIR: .

defaults:
run:
shell: bash

jobs:
typo-checker: # NOTE: for Branch protection rule `Status checks that are required.`
runs-on: ubuntu-latest # ref. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- uses: actions/checkout@v4
- name: DEBUG
shell: bash
run: |
cat <<'DEBUG_DOC'
== DEBUG =======================================================
github.ref: ${{ github.ref }}
github.event_name: ${{ github.event_name }}
-- toJSON(github.event.inputs) ---------------------------------
${{ toJSON(github.event.inputs) }}
-- toJSON(github) ----------------------------------------------
${{ toJSON(github) }}
================================================================
DEBUG_DOC
- name: Check spelling
uses: crate-ci/typos@master
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2022 kunitsucom
Copyright 2022 hakadoriya

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# 🚧 Moved [https://github.com/hakadoriya/log.sh](https://github.com/hakadoriya/log.sh) 🚧

# log.sh - JSON logger for POSIX Shell Script

[![license](https://img.shields.io/github/license/kunitsucom/log.sh)](LICENSE)
[![workflow](https://github.com/kunitsucom/log.sh/workflows/sh-test/badge.svg)](https://github.com/kunitsucom/log.sh/tree/main)
[![license](https://img.shields.io/github/license/hakadoriya/log.sh)](LICENSE)
[![workflow](https://github.com/hakadoriya/log.sh/workflows/sh-test/badge.svg)](https://github.com/hakadoriya/log.sh/tree/main)

log.sh is a lightweight and no dependencies JSON logger for POSIX Shell Script.

Expand All @@ -20,14 +18,14 @@ There are two ways.
### 1. Vendoring (recommended)

Copy the log.sh functions in the shell script file ([`index.html`](/index.html)) and paste them where you want to use them.
(file name `index.html` may seem strange, but it's necessary for me to serve Shell Script file in GitHub Pages with as short URL [`https://kunitsucom.github.io/log.sh/`](https://kunitsucom.github.io/log.sh/) as possible)
(file name `index.html` may seem strange, but it's necessary for me to serve Shell Script file in GitHub Pages with as short URL [`https://hakadoriya.github.io/log.sh/`](https://hakadoriya.github.io/log.sh/) as possible)

### 2. Use via HTTP

You can load a shell script function via the Internet as follows:

```console
$ eval "$(curl -fLSs --tlsv1.2 https://kunitsucom.github.io/log.sh/)"
$ eval "$(curl -fLSs --tlsv1.2 https://hakadoriya.github.io/log.sh/)"

$ LogshInfoJSON hello foo bar HOSTNAME ${HOSTNAME}
{"timestamp":"2021-11-26T08:02:08+09:00","severity":"INFO","caller":"-bash","message":"hello","foo":"bar","HOSTNAME":"localhost"} # <- NOTE: stderr
Expand Down
Loading

0 comments on commit 352fa53

Please sign in to comment.