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

# Local Scanner を使った夜間スキャンの実行

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 時と毎晩深夜にスキャンを実行する GitHub Action を作成します。

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

name: Aikido Scan
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 scan
        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) をご覧ください。\
夜間スキャン用のパイプラインを設定したら、スケジュールする必要があります。\
左側のサイドバーで、 **Build > Pipeline schedules**を選択します。\
希望する間隔、タイムゾーン、デフォルトブランチをフォームに入力します。「Create pipeline schedule」をクリックします。その後、スケジュール済みのパイプラインが概要に表示されます。

![「main」ブランチで Aikido の夜間スキャンをスケジュール済み。次回実行まで 21 時間。](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-ddac89fa5d6db4dff4cce8173d8c45a38f5b485d%2Fucarecdn-165e3a66-d238-4ad6-8178-d5b7b5d4067c.png?alt=media)

スケジュール済みパイプラインの詳細は [こちら](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** をビルドトリガーとして選択します。\
以下の例では、毎晩深夜にスキャンをスケジュールします

![cron 構文を使用した、毎日深夜の実行に設定された Jenkins のビルドトリガー。](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-4389a6c4cd930ac678e6949e439a60281d21c4a5%2Fucarecdn-b7966951-f587-491d-ade9-e37fffc02be7.png?alt=media)

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

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

以下の例では、main ブランチで毎晩深夜にスキャンを実行する 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.
