Skip to content

Commit

Permalink
Merge pull request #1 from dora56/github-actions
Browse files Browse the repository at this point in the history
chore: Add GitHub Actions
  • Loading branch information
dora56 authored Dec 20, 2023
2 parents 9aa678e + b37a361 commit 4672511
Show file tree
Hide file tree
Showing 7 changed files with 10,100 additions and 4,399 deletions.
16 changes: 16 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Common Build
description: Common Operation(build)
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v2
with:
node-version: '20.10.x'

- name: Install dependencies
run: npm install
shell: bash

- name: build
run: npm run build
shell: bash
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: weekly
timezone: 'Asia/Tokyo'
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
workflow_run:
workflows:
- Test
branches:
- main
types:
- completed

permissions:
contents: write
issues: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
uses: ./.github/actions/build
- name: Release
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on: [push]

jobs:
canCreateRuleFile:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
uses: ./.github/actions/build
- run: npm run createrule

test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
uses: ./.github/actions/build
- name: Jest testing
run: npm run test:jest
- name: TextLint testing
run: npm run test:lint
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
directory: ./coverage
44 changes: 44 additions & 0 deletions .github/workflows/update-dict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Auto-create regular rules
permissions:
contents: write
pull-requests: write

on:
schedule:
- cron: '0 0 1 * *'
- cron: '0 0 15 * *'
workflow_dispatch:

env:
HAS_CHANGES: ''

jobs:
auto-create-rules:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build
uses: ./.github/actions/build

- name: Run createRule.js
run: npm run createrule

- name: Check for changes in auto-create-regular-rules.yml
id: check-diff
run: echo "HAS_CHANGES=$(git diff --name-only)" >> $GITHUB_ENV

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
if: ${{ env.HAS_CHANGES }} == 'dict/auto-create-regular-rules.yml'
with:
title: 'Update auto-create-regular-rules.yml'
commit-message: 'feat: update auto-create-regular-rules.yml'
branch: auto-update-regular-rules
base: main
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 4672511

Please sign in to comment.