> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/kdosukyan/local-code-scanning/performing-nightly-scans-using-the-aikido-local-scanner.md).

# ローカルスキャナーを使った夜間スキャンの実行

CI に Aikido Local Scanner を導入する場合は、デフォルトブランチへの変更時にスキャンを実行することを推奨します。特に定期的に更新されないリポジトリでは、一定間隔でのスケジュールスキャンも検討するとよいでしょう。この記事では、こうした定期スキャンの設定に焦点を当てます。特定の CI/CD ツール向けに Local Scanner を設定する詳細が必要な場合は、それぞれのツールのガイドを参照してください。

## GitHub Actions で夜間スキャンを設定する <a href="#setting-up-a-nightly-scan-in-github-actions" id="setting-up-a-nightly-scan-in-github-actions"></a>

以下の例では、main ブランチへの push 時と、毎晩 0 時にスキャンを実行する GitHub Action を作成します。

```yaml
on:
  push:
    branches:
      - main
  schedule:
    - cron: '0 0 * * *'

name: Aikido スキャン
jobs:
  aikido-local-scan-repo:
    runs-on: ubuntu-latest
    container:
      image: aikidosecurity/local-scanner:latest
    steps: 
      - uses: actions/checkout@v4 
        with: 
          token: ${{ secrets.GITHUB_TOKEN }} 
          path: my-repo 
      - name: スキャンを実行
        run: aikido-local-scanner scan my-repo --apikey ${{ secrets.AIKIDO_API_KEY }} --repositoryname MyRepo --branchname main
```

GitHub Actions を使ったスキャンの設定方法の詳細は [こちら](/docs/docs-ja/kdosukyan/local-code-scanning/github-action-setup-for-local-code-scanning.md).\
GitHub Action で schedule オプションを使う方法の詳細は [こちら](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule).

## GitLab で夜間スキャンを設定する <a href="#setting-up-a-nightly-scan-in-gitlab" id="setting-up-a-nightly-scan-in-gitlab"></a>

GitLab プロジェクトであらかじめパイプラインを設定しておく必要があります。詳細は [この記事](/docs/docs-ja/kdosukyan/local-code-scanning/gitlab-self-managed-setup-for-local-code-scanning.md) をご覧ください。\
夜間スキャン用のパイプラインを設定したら、スケジュールする必要があります。\
左側のサイドバーで次を選択します **ビルド > パイプラインのスケジュール**.\
フォームに希望の間隔、タイムゾーン、デフォルトブランチを入力します。'Create pipeline schedule' をクリックしてください。すると、スケジュールされたパイプラインが概要に表示されます。

!['main' ブランチで夜間の Aikido スキャンをスケジュールしました。次回実行まであと 21 時間です。](/files/d6e527071528bfa9fd9906274389f736af594259)

スケジュール済みパイプラインの詳細は [こちら](https://archives.docs.gitlab.com/16.6/ee/ci/pipelines/schedules.html).

## Jenkins で夜間スキャンを設定する <a href="#setting-up-a-nightly-scan-in-jenkins" id="setting-up-a-nightly-scan-in-jenkins"></a>

Jenkins でスケジュールスキャンを設定するには、次を選択します **定期的にビルド** をビルドトリガーとして指定します。\
以下の例では、毎晩 0 時にスキャンをスケジュールします

![cron 構文を使用して、毎日 0 時に実行されるように設定された Jenkins のビルドトリガー。](/files/f231d94b48bdd3320a7c41e70467c3fc6e67896c)

Jenkins で Local Scanner を設定する詳細は [こちら](/docs/docs-ja/kdosukyan/local-code-scanning/jenkins-setup-for-local-code-scanning.md).

### Azure DevOps で夜間スキャンを設定する

以下の例では、main ブランチで毎晩 0 時に夜間スキャンを実行する Azure DevOps パイプラインを作成します。

```yaml
trigger: none

schedules:
- cron: "0 0 * * *"
  displayName: 夜間の Aikido スキャン
  branches:
    include:
    - main
  always: true

pool:
  vmImage: 'ubuntu-latest'

container:
  image: aikidosecurity/local-scanner:latest
  options: --entrypoint=""

steps:
- script: aikido-local-scanner scan $BUILD_SOURCESDIRECTORY --apikey $(AIKIDO_API_KEY) --repositoryname $BUILD_REPOSITORY_NAME --branchname main
  displayName: 'Aikido セキュリティスキャンを実行'
```

Azure DevOps でスケジュール済みパイプラインを設定する詳細は [こちら](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/kdosukyan/local-code-scanning/performing-nightly-scans-using-the-aikido-local-scanner.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
