> 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).

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

Aikido Local Scanner を CI に実装する場合は、デフォルトブランチへの変更に対してスキャンを実行することを推奨します。更新が定期的に行われない一部のリポジトリでは、固定間隔でスケジュールスキャンを実行することも検討できます。この記事では、こうした定期スキャンの設定に焦点を当てます。特定の 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 時と、毎日深夜にスキャンを実行する 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 でスケジュールされたスキャンを設定するには、 **Build Periodically** をビルドトリガーとして選択します。\
以下の例では、毎日深夜 0 時にスキャンをスケジュールします

![Jenkins のビルドトリガーを cron 構文を使って毎日深夜 0 時に実行するよう設定。](/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.
