{% extends "base.html.j2" %}

{% if saved_config.type == "GitHub" %}
    {% set ci_provider = "GitHub Actions" %}
{% elif saved_config.type == "GitLab" %}
    {% set ci_provider = "GitLab CI" %}
{% endif %}

{% block content %}
<p>Hello {{ recipient }}!</p>

{% if recipient == auth_user.gh_login -%}
<p>You added a new "Trusted Publishing" configuration for {{ ci_provider }} to your crate "<strong>{{ krate.name }}</strong>". Trusted publishers act as trusted users and can publish new versions of the crate automatically.</p>
{%- else -%}
<p>crates.io user {{ auth_user.gh_login }} added a new "Trusted Publishing" configuration for {{ ci_provider }} to a crate that you manage ("<strong>{{ krate.name }}</strong>"). Trusted publishers act as trusted users and can publish new versions of the crate automatically.</p>
{%- endif %}

{% if saved_config.type == "GitHub" -%}
<p>This configuration allows the workflow file at <a href="https://github.com/{{ saved_config.repository_owner }}/{{ saved_config.repository_name }}/blob/HEAD/.github/workflows/{{ saved_config.workflow_filename }}">https://github.com/{{ saved_config.repository_owner }}/{{ saved_config.repository_name }}/blob/HEAD/.github/workflows/{{ saved_config.workflow_filename }}</a> to publish new versions of this crate.
{%- if saved_config.environment %} The workflow must use the <code>{{ saved_config.environment }}</code> environment (<a href="https://github.com/{{ saved_config.repository_owner }}/{{ saved_config.repository_name }}/deployments/{{ saved_config.environment }}">https://github.com/{{ saved_config.repository_owner }}/{{ saved_config.repository_name }}/deployments/{{ saved_config.environment }}</a>).
{%- endif %}</p>
{% elif saved_config.type == "GitLab" -%}
<p>This configuration allows the workflow file at <a href="https://gitlab.com/{{ saved_config.namespace }}/{{ saved_config.project }}/-/blob/HEAD/{{ saved_config.workflow_filepath }}">https://gitlab.com/{{ saved_config.namespace }}/{{ saved_config.project }}/-/blob/HEAD/{{ saved_config.workflow_filepath }}</a> to publish new versions of this crate.
{%- if saved_config.environment %} The workflow must use the <code>{{ saved_config.environment }}</code> environment.
{%- endif %}</p>
{% endif %}
<p>If you did not make this change and you think it was made maliciously, you can remove the configuration from the crate via the "Settings" tab on the crate's page.</p>

<p>If you are unable to revert the change and need to do so, you can email <a href="mailto:help@crates.io">help@crates.io</a> for assistance.</p>
{% endblock %}
