Skip to content
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: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>5ouma/utils"],
"extends": ["github>5ouma/utils", "github>Omochice/renovate-config:deno"],
"pre-commit": { "enabled": true },
"renovate-config-presets": {
"managerFilePatterns": ["/(^|/).?(renovate(?:rc)?|default)(?:\\.json5?)?$/"]
Expand Down
55 changes: 13 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ on:
branches:
- main
paths:
- pre-commit/hooks/**/*
- pre-commit/hooks/*
- .github/workflows/ci.yml
pull_request:
paths:
- pre-commit/hooks/**/*
- pre-commit/hooks/*
- .github/workflows/ci.yml

permissions: {}

jobs:
detect:
name: 🔄 Detect Deno Projects
name: 🔄 Detect Changed Projects
runs-on: Ubuntu-Slim
timeout-minutes: 1
outputs:
projects: ${{ steps.get-directories.outputs.result }}
hooks: ${{ steps.filter.outputs.hooks }}
ci: ${{ steps.filter.outputs.ci }}

steps:
- name: 🚚 Check out repository
Expand All @@ -33,43 +34,19 @@ jobs:
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
hook:
- added|modified: ["pre-commit/hooks/**/*"]
hooks:
- added|modified: ["pre-commit/hooks/*"]
ci: [".github/workflows/ci.yml"]
list-files: json

- name: 📁 Get directories
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
id: get-directories
with:
script: |
const path = require("path");

if (JSON.parse(process.env.ci)) {
const globber = await glob.create("pre-commit/hooks/*/deno.json");
const files = await globber.glob();
return files.map(file => path.relative(process.env.GITHUB_WORKSPACE, path.dirname(file)));
}

const files = JSON.parse(process.env.files);
const dirs = files.map(file => file.match(/^(pre-commit\/hooks\/[^/]+)/)[1]);
return Array.from(new Set(dirs));
env:
files: ${{ steps.filter.outputs.hook_files }}
ci: ${{ steps.filter.outputs.ci }}

lint-check:
name: 🧹 Lint Check
needs: detect
if: ${{ needs.detect.outputs.hooks || needs.detect.outputs.ci }}
runs-on: Ubuntu-Slim
defaults:
run:
working-directory: ${{ matrix.project }}
working-directory: pre-commit/hooks
timeout-minutes: 1
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.detect.outputs.projects) }}

steps:
- name: 🚚 Check out repository
Expand All @@ -93,14 +70,11 @@ jobs:
format-check:
name: 📝 Format Check
needs: detect
if: ${{ needs.detect.outputs.hooks || needs.detect.outputs.ci }}
runs-on: Ubuntu-Slim
defaults:
run:
working-directory: ${{ matrix.project }}
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.detect.outputs.projects) }}
working-directory: pre-commit/hooks
timeout-minutes: 1

steps:
Expand All @@ -118,14 +92,11 @@ jobs:
type-check:
name: 🔍 Type Check
needs: detect
if: ${{ needs.detect.outputs.hooks || needs.detect.outputs.ci }}
runs-on: Ubuntu-Slim
defaults:
run:
working-directory: ${{ matrix.project }}
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.detect.outputs.projects) }}
working-directory: pre-commit/hooks
timeout-minutes: 1

steps:
Expand Down
4 changes: 3 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
- id: upload-git-commit-notion
name: Upload Git Commits to Notion
description: Upload not pushed Git commits data to Notion database
entry: pre-commit/hooks/upload-git-commit-notion/main.ts
entry: upload-git-commit-notion
language: deno
additional_dependencies:
- ./pre-commit/hooks/upload-git-commit-notion.ts:upload-git-commit-notion
always_run: true
verbose: true
pass_filenames: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env -S deno run -P
#!/usr/bin/env -S deno run -EN='api.notion.com' --allow-run='git,op'

import { git } from "@roka/git";
import gitUrlParse from "git-url-parse";
import { item } from "@1password/op-js";
import { Client } from "@notionhq/client";
import { git } from "jsr:@roka/git@0.4.0";
import gitUrlParse from "npm:git-url-parse@16.1.0";
import { item } from "npm:@1password/op-js@0.1.13";
import { Client } from "npm:@notionhq/client@5.21.0";

const range = {
from: Deno.env.get("PRE_COMMIT_FROM_REF"),
Expand Down
11 changes: 0 additions & 11 deletions pre-commit/hooks/upload-git-commit-notion/deno.json

This file was deleted.

124 changes: 0 additions & 124 deletions pre-commit/hooks/upload-git-commit-notion/deno.lock

This file was deleted.

Loading