Skip to content

Commit

Permalink
feat: レポジトリ名をmelos.yaml, pubspec.yamlに適用
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-hd committed Jul 19, 2024
1 parent 4cd0c8f commit 26bb2fd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/actions/fill-project-name/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Fill project name"
description: "Fill project name of melos.yaml and pubspec.yaml with the repository name"

runs:
using: "composite"
steps:
- name: Fill the project name
uses: mikefarah/yq@f15500b20a1c991c8729870ba60a4dc3524b6a94 # v4.44.2
with:
cmd: |
yq '.name = "${{ github.event.repository.name }}"' melos.yaml > melos.yaml.new
yq '.name = "${{ github.event.repository.name }}"' pubspec.yaml > pubspec.yaml.new
- name: Keep empty lines
# NOTE: /~https://github.com/mikefarah/yq/issues/515
run: |
diff -U0 -w -b --ignore-blank-lines melos.yaml melos.yaml.new > melos.yaml.diff || true
diff -U0 -w -b --ignore-blank-lines pubspec.yaml pubspec.yaml.new > pubspec.yaml.diff || true
patch melos.yaml < melos.yaml.diff
patch pubspec.yaml < pubspec.yaml.diff
rm melos.yaml.{new,diff} pubspec.yaml.{new,diff}
shell: bash
19 changes: 19 additions & 0 deletions .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Debug

on:
push:
branches:
- feature/apply-repository-name

jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Fill project name
uses: ./.github/actions/fill-project-name

- run: |
git diff
3 changes: 3 additions & 0 deletions .github/workflows/template-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Remove unnecessary files
uses: ./.github/actions/remove-unnecessary-files

- name: Fill project name
uses: ./.github/actions/fill-project-name

- name: Commit files
run: |
git config --local user.email "action@github.com"
Expand Down

0 comments on commit 26bb2fd

Please sign in to comment.