Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v0 #1

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
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
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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:
- "*"

- package-ecosystem: "swift"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "11:00"
timezone: "Asia/Tokyo"
commit-message:
prefix: "build(swift): "
labels:
- "build"
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 -->
38 changes: 38 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# https://docs.github.com/ja/repositories/releasing-projects-on-github/automatically-generated-release-notes
changelog:
categories:
- title: "💥 BREAKING CHANGES"
labels:
- BREAKING CHANGE
- title: "⬆️ Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
labels:
- build
- dependencies
- title: "👷 Changes to our CI configuration files and scripts (examples: CircleCi, SauceLabs)"
labels:
- ci
- title: "📝 Documentation only changes"
labels:
- docs
- title: "✨ A new feature"
labels:
- feat
- title: "🐛 A bug fix"
labels:
- fix
- title: "⚡️ A code change that improves performance"
labels:
- perf
- title: "♻️ A code change that neither fixes a bug nor adds a feature"
labels:
- refactor
- title: "✅ Adding missing tests or correcting existing tests"
labels:
- test
- title: "🚨 Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
labels:
- style
- title: "🧑‍💻 Changes to the build process or auxiliary tools and libraries such as documentation generation"
labels:
- chore
- "*"
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 }}
76 changes: 76 additions & 0 deletions .github/workflows/label-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: label-checker

# Dependabot
# gh label create --force "dependencies" --description "Pull requests that update a dependency file" --color 0366D6
# 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

# 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
23 changes: 23 additions & 0 deletions .github/workflows/task-list-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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:
contents: read
pull-requests: read
steps:
- uses: hakadoriya/[email protected]
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
7 changes: 7 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 1,
"lineLength" : 10000,
"indentation": {
"spaces": 4
}
}
Loading
Loading