GitHub Action
Optimizely - Custom Code Uploader
A Github Action that enables Optimizely customers to upload custom JS / CSS to their Web projects.
-
Set up your Optimizely Access Token as a secret in your repository settings. For the example workflows, use
OPTIMIZELY_API_ACCESS_TOKEN
as the secret name. -
Make sure you have the IDs of the projects, experiments, or variations that you want to update. See the API Names tab in the sidebar of your experiment for this information.
-
Note that at this time, this Github Action only supports A/B tests and Multi-armed Bandit tests in Web Projects. Performance Edge projects, Personalization Campaigns, Multivariate tests are not currently supported.
Required - Your Optimizely access token.
- The easiest way is to store this as a repository secret
and then pass it in your workflow via
${{secrets.NAME_OF_YOUR_OPTIMIZELY_API_ACCESS_TOKEN_SECRET}}
.
The file path to the file containing the code to be uploaded to Optimizely. The file path should start from the root directory of the repository.
- The file path must be passed in via this input field or through the parameter comment field.
This is the level at which the code is being uploaded to. Choose between project
, experiment
, or variation
.
- By default, it is set to
variation
.
This is the type of code that is being uploaded. Choose between custom_code
or custom_css
.
- When the
custom-code-level
isproject
, it is assumed that the code type iscustom_code
. - By default, it is set to
custom_code
.
This is the ID for the project to upload the code to.
- Only needed for
project
level code changes.
This is the ID of the experiment to upload the code to.
- Only needed for
experiment
orvariation
level code changes.
This is the ID of the variation to upload the code to.
- Only needed for
variation
level code changes.
This is the ID of the page associated with the variation that the code is being uploaded to.
- Only needed for
variation
level code changes.
This is a string that can be used to pass in all the other parameters except for optimizely-access-token
and fail-silently
.
Example: parameters-comment: '--experiment-id=1 --custom-code-path=./code/my_file.js --custom-code-type=custom_code --custom-code-level=experiment'
If set to true
, then no comment will be appended to the end of the code that is uploaded.
- By default, this is set to
false
.
A string to be appended as a comment at the end of the code that is uploaded.
- By default, this is set to "This code was uploaded via the Optimizely Upload Custom Code Github Action."
When set to true, this action will only record errors in logs. It will not fail the entire workflow.
- By default, this is set to
false
.
This is set to whether or not the code upload is successful.
If the code upload is not successful, the error message is set to this value.
See the Examples folder in this repository for example workflows that utilize this action.
To learn more about how this action works and how to update this action, see Architecture.md.