Skip to content

Commit e4f147a

Browse files
aster-voidclaude
andcommitted
mise exec 式に移行: shebang 変更, working_dir 削除
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d20f908 commit e4f147a

6 files changed

Lines changed: 45 additions & 12 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@ mise install # ツールをインストール (初回 or mise.toml 変更時)
3030

3131
### 3. `run.sh` を作る
3232

33+
shebang は `#!/usr/bin/env -S mise exec -- bash` にする。mise がランタイム (bun, node 等) を解決する。
34+
スクリプト先頭で `cd "$(dirname "$0")"` して自分のディレクトリに移動する。
35+
3336
### 4. `rollcron.yaml` に追加
3437

3538
```yaml
3639
my-bot:
40+
<<<<<<< Updated upstream
3741
schedule: "7pm" # 下記参照
3842
working_dir: bots/my-bot
3943
run: ./run.sh
44+
||||||| Stash base
45+
schedule: "7pm" # 下記参照
46+
working_dir: bots/my-bot
47+
run: ./run.sh
48+
=======
49+
schedule: "7pm" # 下記参照
50+
run: bots/my-bot/run.sh
51+
>>>>>>> Stashed changes
4052
log: ~/run/discord-bots/my-bot/log
4153
# build: ./build.sh # コンパイルが必要な場合
4254
# env_file: ~/run/discord-bots/my-bot/env # 環境変数が必要な場合
@@ -99,6 +111,12 @@ sops を使わない場合:
99111
## コマンド
100112

101113
```bash
114+
<<<<<<< Updated upstream
115+
||||||| Stash base
116+
eval "$(direnv export bash)" && COMMAND
117+
=======
118+
mise exec -- COMMAND
119+
>>>>>>> Stashed changes
102120
sops exec-env path/to/sops.env 'echo success!' # sops 鍵検証
103121
ssh USER@coolify.utcode.net "sudo -u deploy bash -c 'COMMAND'" # デプロイ先で操作
104122
```

bots/asakatsu-bot/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env -S mise exec -- bash
22
set -euo pipefail
3+
cd "$(dirname "$0")"
34

45
function bail() {
56
echo "$@"

bots/auto-moderator/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env -S mise exec -- bash
22
set -euo pipefail
3+
cd "$(dirname "$0")"
34

45
bun install --frozen-lockfile
56
sops exec-env sops.env 'bun start'

bots/gsc-report/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env -S mise exec -- bash
22
set -euo pipefail
3+
cd "$(dirname "$0")"
34

45
npm ci || {
56
echo 'WARNING: npm ci failed. falling back to npm install' 2>&1

bots/joji-bot/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env -S mise exec -- bash
22
set -euo pipefail
3+
cd "$(dirname "$0")"
34

45
bun install --frozen-lockfile
56
bun --env-file=.env run index.ts

rollcron.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,46 @@ runner:
88
jobs:
99
auto-moderator:
1010
schedule: noon
11-
run: ./run.sh
12-
working_dir: bots/auto-moderator
11+
run: bots/auto-moderator/run.sh
1312
log: ~/run/discord-bots/auto-moderator/log
1413

1514
gsc-report:
1615
schedule: "7am every Sunday"
17-
run: ./run.sh
18-
working_dir: bots/gsc-report
16+
run: bots/gsc-report/run.sh
1917
env_file: ~/run/discord-bots/gsc-report/env
2018
log: ~/run/discord-bots/gsc-report/log
2119

2220
asakatsu-bot-ask:
2321
schedule: 7PM
24-
run: ./run.sh ask
25-
working_dir: bots/asakatsu-bot
22+
run: bots/asakatsu-bot/run.sh ask
2623
env_file: ~/run/discord-bots/asakatsu-bot/env
2724
log: ~/run/discord-bots/asakatsu-bot/log
2825

2926
asakatsu-bot-check:
3027
schedule: 8AM
31-
working_dir: bots/asakatsu-bot
32-
run: ./run.sh check
28+
run: bots/asakatsu-bot/run.sh check
3329
env_file: ~/run/discord-bots/asakatsu-bot/env
3430
log: ~/run/discord-bots/asakatsu-bot/log
3531

32+
<<<<<<< Updated upstream
3633
# joji-bot:
3734
# schedule: "7pm"
3835
# working_dir: bots/joji-bot
3936
# run: ./run.sh
4037
# env_file: ~/run/discord-bots/joji-bot/env
4138
# log: ~/run/discord-bots/joji-bot/log
39+
||||||| Stash base
40+
joji-bot:
41+
schedule: "7pm"
42+
working_dir: bots/joji-bot
43+
run: ./run.sh
44+
env_file: ~/run/discord-bots/joji-bot/env
45+
log: ~/run/discord-bots/joji-bot/log
46+
=======
47+
joji-bot:
48+
schedule: "7pm"
49+
run: bots/joji-bot/run.sh
50+
env_file: ~/run/discord-bots/joji-bot/env
51+
log: ~/run/discord-bots/joji-bot/log
52+
>>>>>>> Stashed changes
4253

0 commit comments

Comments
 (0)