Skip to content

Commit

Permalink
Merge pull request #5 from toridori-inc/use_env
Browse files Browse the repository at this point in the history
Retrieve git username and email address from environment variables.
  • Loading branch information
K9i-0 authored Apr 6, 2023
2 parents dedd4c6 + 9004224 commit 86de645
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.1
- Retrieve git username and email address from environment variables.

## 1.0.0

- Initial version.
16 changes: 6 additions & 10 deletions lib/src/toridori_grinder_tasks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ import 'package:yaml/yaml.dart';
void addAllTasks({
required String repositoryOwner,
required String repositoryName,
required String gitUserEmail,
required String gitUserName,
}) {
addFormatTask();
addReleaseTask(
repositoryOwner: repositoryOwner,
repositoryName: repositoryName,
);
addOnReleasePrMergedTask(
gitUserEmail: gitUserEmail,
gitUserName: gitUserName,
);
addOnReleasePrMergedTask();
}

void addFormatTask() {
Expand Down Expand Up @@ -68,15 +63,16 @@ void addReleaseTask({
);
}

void addOnReleasePrMergedTask({
required String gitUserEmail,
required String gitUserName,
}) {
void addOnReleasePrMergedTask() {
addTask(
GrinderTask(
'on-release-pr-merged',
description: 'Release PRがマージされたときのタスク',
taskFunction: () async {
// 環境変数からgitのユーザー名とメールアドレスを取得
final envVars = Platform.environment;
final gitUserName = envVars['GIT_USER_NAME'];
final gitUserEmail = envVars['GIT_USER_EMAIL'];
run('git',
arguments: ['config', '--local', 'user.email', '"$gitUserEmail"']);
run('git',
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: toridori_grinder_tasks
description: A starting point for Dart libraries or applications.
version: 1.0.0
version: 1.0.1
# repository: https://github.com/my_org/my_repo

environment:
Expand Down

0 comments on commit 86de645

Please sign in to comment.