docs/contributing-code.md
Thank you for helping make AMP better by fixing bugs, adding features or improving the AMP code in some other way!
This document describes the process you will go through to make a change in AMP.
We want to make it as easy as possible to get in small fixes. A fix for a small bug should be as easy as creating a PR with the change, adding/fixing a test, and sending it to a reviewer.
If your run into any issues finding a Reviewer/Owner or have any other questions, ping the #contributing channel on Slack.
Significant changes (e.g. new components or significant changes to behavior) require consultation with and approval from knowledgeable members of the community.
If you are making a change to existing behavior, familiarize yourself with AMP's policy on breaking changes.
If you are deprecating/removing a feature, follow the deprecation process instead of this process.
A guide is a member of the AMP community who is knowledgeable about the area you are modifying and who can guide you from the design phase all the way through launch.
A guide is required if you are making a substantial change to AMP, but is optional if you are making smaller changes.
To find a guide:
Once you have found a guide, make sure to @-mention them on any issues / PRs related to your change (e.g. if mrjoro is your guide you can just add "/cc @mrjoro" in the issue/PR body or comment).
enable-git-pre-push.sh.AMP is designed to be extensible - it is meant to support “Extended Components” that provide first-class support for additional rich features.
Because Extended Components may have significant impact on AMP performance, security, and usage, Extended Component contributions will be very carefully analyzed and scrutinized.
In particular, we strive to design the overall component set, so that a large number of use cases can be composed from them. Instead of creating a new component it may thus be a better solution to combine existing components to a similar effect.
We have a few additional resources that provide an introduction to contributing extended components:
For further detail on integrating third-party services (e.g., fonts, embeds, etc.), see our 3p contribution guidelines.
AMP requires all contributors to agree to the OpenJSF Contributor License Agreement in order to protect contributors and users in issues of intellectual property.
To agree to the OpenJSF Contributor License Agreement, visit https://cla-assistant.io/ampproject/amphtml, read through the agreement, and click "Sign in with GitHub to agree."
Alternatively, you also have the option of downloading the Contributor License Agreement from https://individual-cla.openjsf.org, filling it in, signing it, writing in your GitHub handle, and emailing it to [email protected]. As processing your CLA is done manually, this takes much longer and is therefore not recommended.
All code in AMP must be reviewed and approved before it is merged. Reviewers/Collaborators primarily ensure that the code is correct, efficient and consistent with existing AMP code while Owners primarily provide a domain-specific review of the code.
To be merged, all code must be approved by both:
It is acceptable for one person to fulfill these requirements, e.g. if an Owner who is also a Reviewer approves the PR it may be merged.
We now have a bot that will automatically assign Owners to a PR once it is created, and it is likely at least one of these Owners will also be a Reviewer.
Once the PR has been approved, anyone with commit rights to the repository may merge the PR, including its author.
These guidelines are specific to the amphtml repository. Other ampproject repos may follow the same guidelines or use different guidelines as documented in their docs/contributing.md files.
We have a well-defined process for handling requests for changes to the experimental/beta, stable, or lts release builds. These changes are known as "cherry-picks".
Note: We do not support cherry-picks into the nightly release channel; in the event of security or privacy issues, a rollback is performed instead.
The bar for getting a cherry-pick into a live release is very high because our goal is to produce high quality launches on a predictable schedule.
Keep in mind that performing a cherry-pick requires a significant amount of work from you and the on-duty engineer and they can take a long time to process.
The following outlines the process to request a cherry-pick.
If you are requesting a cherry-pick to fix an issue in production it is likely you will also need a cherry-pick into the experimental/beta releases. Problems cherry-picked in stable could be overridden after promoting beta. The on-duty engineer will help determine if you need to cherry-pick both release channels.
It is possible that a P0 issue gets discovered on Monday or Tuesday, when it was already present in the code-base in the previous week. When that happens, the previous week's nightly release (which is bound to be promoted to experimental/beta on Tuesday morning) will contain the offending code without the fix. In this case, the release on-duty engineer must perform a cherry-pick before promoting last week's nightly to experimental/beta.
Note: While the cherry-pick is performed on top of last week's nightly release, we do not promote that fix to the nightly release channel. This is because the cherry-pick is performed on top of a previous nightly release, not on top of the latest.
If you run into any issues or have any questions when requesting a cherry-pick, please use the AMP Slack #release channel (sign up for Slack).