Variables list and description

You can use the following variables in your template.

jira_ids: string[]

A list of Jira tickets associated with the issues contained within the pull request. Ensurethat the Snyk Jira integration is enabled on the Project or repository that contains the Project and that you have linked Snyk issues to JIRA tickets.

To automatically link Jira to the relevant pull requests, include a list of associated Jira tickets in the commit message.

Input

{
    "data": {
        "attributes": {
            "commit_message": "This pull request is from Snyk and relates to {{ jira_ids }}" 
        },
        "type": "pull_request_template"
    }
}

Output

The commit message of your PR will be:

This pull request is from Snyk and relates to JIRA-1,JIRA-2,JIRA-3

This output indicates that the suggested solution successfully resolved three problems. It also includes links to every Jira ticket.

snyk_project_url: string

This is the Snyk Project URL and can be used to link to the Snyk Project page.

Input

{
    "data": {
        "attributes": {
            "description": "To find more details, see the Snyk project {{ snyk_project_url }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

To find more details, see the Snyk project https://app.snyk.io/org/my-org/project/xx-xxx-xx-xx

In this output, my-org is your Snyk Organization name and xx-xxx-xx-xx-xxxx is the public ID of your Project or repository.

snyk_project_name: string

This is the Snyk Project name. You can add the Snyk Project name to your description.

Input

{
    "data": {
        "attributes": {
            "description": "Fix applied to project {{ snyk_project_name }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

Fix applied to project my-org/project:filename

snyk_org_name: string

This is the Snyk Organization name. You can add the Snyk Organization name to your description.

Input

{
    "data": {
        "attributes": {
            "description": "Fix applied by {{ snyk_org_name }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

Fix applied by my-org

package_name: string

This is the name of the package being fixed or upgraded. When more than one package is changed, this variable will default to the first one.

Follow this example to display in the description the package name of the first dependency being fixed in the PR.

Input

{
    "data": {
        "attributes": {
            "description": "Fixes {{ package_name }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

Fixes adm-zip

package_from: string

This is the version of the package that is being fixed or upgraded. In cases where more than one package is changed, this variable will default to the from version of the first one.

Input

{
    "data": {
        "attributes": {
            "description": "Fix is applied by moving from {{ package_from}}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

Fix is applied by moving from 0.4.7

package_to: string

The package is transitioning to this particular version. In cases where more than one package is changed, this variable will default to the to version of the first one.

Input

{
    "data": {
        "attributes": {
            "description": "Fix is applied by moving to {{ package_to}}"
            
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

Fix is applied by moving to 0.5.2

issue_count: number

This is the number of issues in your Project or repository that are covered by the PR.

Input

{
    "data": {
        "attributes": {
            "description": "The PR will fix {{ issue_count }} issues."
        },
        "type": "pull_request_template"
    }
}

Output

The description of your PR will be:

The PR will fix 98 issues.

product_is_container: boolean

This variable can be used to customize attributes based on whether the PR is a Snyk Container product. Currently, there are two different product types at Snyk that can open PRs (Snyk Open Source PRs and Snyk Container PRs). Using this variable will help you customize your template to differentiate between the two.

Input

{
    "data": {
        "attributes": {
            "description": "{{ #product_is_container }} This Container PR has been opened to fix vulnerabilities in your project. {{ /product_is_container }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

If your PR is an Open Source product, then the description of your PR will be:

This Container PR has been opened to fix vulnerabilities in your project

product_is_open_source: boolean

This variable can be used to customize attributes based on whether the PR is an Open-Source product. Currently, Snyk has two different product types that can open PRs (Open-Source PRs and Container PRs). Using this variable will help you customize your template to differentiate between the two.

Input

{
    "data": {
        "attributes": {
            "description": "{{ #product_is_open_source }} This Open Source PR has been opened to fix vulnerabilities in your project. {{ /product_is_open_source }}"
            
        },
        "type": "pull_request_template"
    }
}

Output

If your PR is an Open Source product then the description of your PR will be:

This Open Source PR has been opened to fix vulnerabilities in your project

is_fix_pr: boolean

This variable can be used to customize attributes based on whether the PR is a backlog PR, for example, opened to fix new vulnerabilities introduced to the Project or repository in the latest scan. In the example below, you can see that the description of the PR will only show if it is a fixed PR.

Input

{
    "data": {
        "attributes": {
            "description": "{{ #is_fix_pr }} This PR has been opened to fix vulnerabilities in your project. {{ /is_fix_pr }}"