generated at
GitHub Actionsで井戸端プロジェクトのバックアップを取得しReleaseに登録する
普段GitHub Actionsを使わないので、勉強しながら試してみたmeganii
🎉nishioinajob基素takkerfumitosta
takker99/scrapbox-backupsで使わせていただいても良いですか?takker
お願いします!meganii
わーいtakker

schedule で時間実行
workflow_dispatch で手動トリガー実行

Tagとして日付を入れておけばよさそう
About releases - GitHub Docsによると、1つのRelaseは2GBまでだが、Release全体の容量制限はなさそう
github releaseを使う方法は考えの外だったtakker
差分を見たかったので、repoに直接pushしていた
repoに入れるのと同時にreleaseでjsonを生成するのも便利そう

.github/workflows/scheduled-build.yml
name: Scheduled build on: schedule: - cron: 0 18 * * * workflow_dispatch: jobs: build: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v2 - uses: denoland/setup-deno@v1 - name: Backup data run: > deno run --allow-read --allow-net --allow-write --no-check index.ts
| > の違いはなんでしょうか?takker
yamlの仕様を見ればわかるかな?
すみません、参考元で利用していたので、安易に使っていましたmeganii
| は複数行を処理するのに利用するという理解でしたが、 > はとりあえず真似した感じです
要調査 調べましたmeganii
ありがとうございます!takker
> : 改行コードが無視されて、1つのコマンドとして実行
>Key: >
> this is my very very very
> long string
this is my very very very long string\n
| : それぞれ改行コードが入るので、並べれば複数コマンド実行
>Key: |
> this is my very very very
> long string
this is my very very very\nlong string\n
なるほど~。 | \ \ (JS)や @"" (C#)などの生文字列リテラル相当の記号になるんですねtakker

.github/workflows/scheduled-build.yml
- name: Zip run: zip data data.json - name: Set Date env: TZ: "Asia/Tokyo" run: echo "CURRENT_DATETIME=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Release uses: ncipollo/release-action@v1 with: artifacts: "data.zip" token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ env.CURRENT_DATETIME }}
なるほど~こうやってworkflow.ymlを書くのかtakkernishio

利用制限に引っかかるかどうか
>cryptomining;
マイニングではない
>disrupting, gaining, or attempting to gain unauthorized access to, any service, device, data, account, or network (other than those authorized by the GitHub Bug Bounty program);
非該当
>the provision of a stand-alone or integrated application or service offering the Actions product or service, or any elements of the Actions product or service, for commercial purposes;
商用利用でもないので非該当
>any activity that places a burden on our servers, where that burden is disproportionate to the benefits provided to users (for example, don't use Actions as a content delivery network or as part of a serverless application, but a low benefit Action could be ok if it’s also low burden); or
負担も少ないはず
>if using GitHub-hosted runners, any other activity unrelated to the production, testing, deployment, or publication of the software project associated with the repository where GitHub Actions are used.
無関係ではない・・はず。
repoにもページデータをpushすれば無関係じゃなくなるtakker

2022/11/27
ページごとにjsonを分割してコミットするようにしたmeganii
takker99/scrapbox-backupsで実現していたページ単位でのcommitをGitHub Actionsで実行できるようになった
ファイル名にタイトルを使おうと思っていたが、結局ページのidを使うようにした

参考