diff --git a/.github/workflows/react-dependency-check.yaml b/.github/workflows/react-dependency-check.yaml index 8db86ba..220e544 100644 --- a/.github/workflows/react-dependency-check.yaml +++ b/.github/workflows/react-dependency-check.yaml @@ -2,6 +2,10 @@ name: trivy dependency check for package.json # https://github.com/aquasecurity/trivy-action#usage on: push: + paths: + - "src/**.tsx" + - "src/**.ts" + - "public/**.html" schedule: # 日曜日の午前0時に実行 - cron: '0 0 * * 0' diff --git a/.github/workflows/react-jest.yaml b/.github/workflows/react-jest.yaml index 275e6cb..c18aa03 100644 --- a/.github/workflows/react-jest.yaml +++ b/.github/workflows/react-jest.yaml @@ -1,5 +1,10 @@ name: run-jest -on: [push] +on: + push: + paths: + - "src/**.tsx" + - "src/**.ts" + - "public/**.html" defaults: run: diff --git a/.github/workflows/react-semgrep.yaml b/.github/workflows/react-semgrep.yaml index 7214c6c..f4ef198 100644 --- a/.github/workflows/react-semgrep.yaml +++ b/.github/workflows/react-semgrep.yaml @@ -3,6 +3,10 @@ name: Semgrep Full Scan #リポジトリの設定から --> Code and automation --> Actions --> GeneralのWorkflow permissionsをRead and write permissionsに[参考画像](../../doc/fig/semgrep_upgrade_grant.png) on: push: + paths: + - "src/**.tsx" + - "src/**.ts" + - "public/**.html" schedule: # 日曜日の午前0時に実行 - cron: '0 0 * * 0' diff --git a/doc/github-actions.md b/doc/github-actions.md index 73c705e..2fe5f20 100644 --- a/doc/github-actions.md +++ b/doc/github-actions.md @@ -32,7 +32,7 @@ actions/setup-python@コミットハッシュ ## GitHub ActionsでSecretを扱う -> [公式ドキュメント](https://docs.github.com/ja/actions/security-guides/using-secrets-in-github-actions) +> GUIの場合は[公式ドキュメント](https://docs.github.com/ja/actions/security-guides/using-secrets-in-github-actions)参照。 ### 2種類のシークレット @@ -41,8 +41,8 @@ actions/setup-python@コミットハッシュ ### 使用方法(CLI) -> [GitHub CLIでリポジトリへsecretを設定](https://zenn.dev/hankei6km/articles/set-secret-to-repo-with-githubcli) -> [GitHub Actionsで機密情報を扱う方法](https://qiita.com/ak2ie/items/4fbcdf74e7760c49c1af) +> [GitHub CLIでリポジトリへsecretを設定する方法](https://zenn.dev/hankei6km/articles/set-secret-to-repo-with-githubcli) +> [GitHub ActionsでEnvironment Secretを扱うサンプル](https://qiita.com/ak2ie/items/4fbcdf74e7760c49c1af) - 個人的には.envから一括投入するのが使いやすそう。今回の例では--envを指定しているが指定しないとRepository Secretになる。 @@ -68,6 +68,22 @@ jobs: --- +## path filterを使って特定のファイル変更時のみCIを走らせる + +- デフォルト設定だと,どのファイルが修正されてもCIが走ってしまうので必要なファイルが更新された時だけCIが起動できるようにする。 + +```shell +name: run-jest +on: + push: + paths: + - "src/**.tsx" + - "src/**.ts" + - "public/**.html" +``` + +--- + ## CodeQLを使ってファイルを出力 ### Advanced Security must be enabled for this repository to use code scanning 403: GitHub Advanced Security is not enabled diff --git a/doc/tools_doc/github-comment.md b/doc/tools_doc/github-comment.md index 2d50f8d..aed4ed9 100644 --- a/doc/tools_doc/github-comment.md +++ b/doc/tools_doc/github-comment.md @@ -20,6 +20,8 @@ GitHub Actionsを使いたい場合には後述の手順を参照。 ## 使い方 +> [公式ドキュメント](https://suzuki-shunsuke.github.io/github-comment/getting-started) + ### 共通してやること - github-comment.yaml(template)を用意する。 diff --git a/src/__tests__/App.test.tsx b/src/__tests__/App.test.tsx index 23cb966..7f6509e 100644 --- a/src/__tests__/App.test.tsx +++ b/src/__tests__/App.test.tsx @@ -2,6 +2,7 @@ import React from "react"; import { render, screen } from "@testing-library/react"; import App from "../App"; +// 画面にLearn Reactの文字が出るかテスト test("renders learn react link", () => { render(); const linkElement = screen.getByText(/learn react/i);