Setup github actions for supergraph previews.
COSMO_API_KEY
.cosmo.yaml
file in the .github
directory of your repository. This file should define the configuration for your subgraphs and feature flags..github/cosmo.yaml
file that defines the configuration for your feature subgraphs and feature flags.routing_url
can include the placeholder string ’${PR_NUMBER}’, which will be replaced with the actual PR number. This enables deployment of the subgraph to a unique URL for each pull request.
config_path
: The path to your cosmo.yaml
configuration file.
create
: Set to true
to create the feature flag and subgraphs.
update
: Set to true
to update the feature subgraphs.
destroy
: Set to true
to destroy the feature flag and subgraphs.
cosmo_api_key
: Your Cosmo API key stored in GitHub secrets.
github_token
: Your GitHub token, typically ${{ secrets.GITHUB_TOKEN }}
.
create
job is triggered when a pull request is opened or reopened. It performs the following actions:
wgc
CLI tool.
cosmo.yaml
file.
cosmo.yaml
file.
update
job is triggered when a pull request is synchronized. It performs the following actions:
wgc
CLI tool.
cosmo.yaml
file.
cosmo.yaml
file.
destroy
job is triggered when a pull request is closed. It performs the following actions:
wgc
CLI tool.
feature_subgraphs_to_deploy
: A list of feature subgraphs to deploy. This output is provided in the create and update jobs.
feature_subgraphs_to_destroy
: A list of feature subgraphs to destroy. This output is provided in the update and destroy jobs.