0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub CodespacesでDeno開発するときの個人メモ

Last updated at Posted at 2023-09-09

GitHub CodespacesでDenoで何か作る時に毎回設定忘れるのでメモです。

VS Code設定

.vscode/settings.json

settings.json
{
    "deno.enable": true,
    "deno.lint": true,
    "deno.unstable": true,
}

この辺入れてないとリンターエラーが

GitHub Actions

DenoをGitHub Actionsで動かしたい時はこちら

.github/workflows/deno.yml
name: 1日2回実行

on:
  push:
    branches: [ main ]
  schedule:
    - cron:  '0 0,12 * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
        - uses: actions/checkout@master
        - uses: denoland/setup-deno@v1
          with:
            deno-version: v1.x

        # - run: deno run https://deno.land/std/examples/welcome.ts
        - name: run
          run: NOTION_TOKEN=${{ secrets.NOTION_TOKEN }} NOTION_KADAI_TEISYUTSU_DB_ID=${{ secrets.NOTION_KADAI_TEISYUTSU_DB_ID }} deno task start

        - name: git commit & push
          run: |
            git config core.filemode false
            if ! git diff --exit-code --quiet
            then
                git add --update
                git config user.name github-actions
                git config user.email action@github.com
                git commit -m "Commit by github-actions"
                git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{github.ref}}
            fi

deno.json

deno.jsonの書き方、npm script的な使い方のところをよく使う

deno.json
{
    "tasks": {
        "start": "deno run --allow-read --allow-env --allow-net --allow-write main.ts",
        "deploy": "git add . && git commit -m 'init' && git push origin main"
    }
}
$ deno task start
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?