> 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を使った夜間スキャンの実行

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 時と毎晩0時にスキャンを実行する 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 > パイプラインのスケジュール**.\
希望する間隔、タイムゾーン、デフォルトブランチをフォームに入力してください。'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** を Build Trigger として選択します。\
下の例では、毎晩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.
