> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Set Up GitHub Actions ## Article: Set Up GitHub Actions ## Article Link: https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/set-up-git-hub-actions.md ## Article Content: # Set Up GitHub Actions To enable a GitHub Actions workflow to perform actions on a Wix site, the workflow must set up and authenticate the Wix CLI using an API key. This allows you to automate tasks like creating preview deployments and publishing site updates directly from your GitHub repository. Follow the steps below to set up GitHub Actions with the Wix CLI. ## Prerequisites Before setting up GitHub Actions, ensure you have: - A Wix site [connected to GitHub](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/set-up-git-integration-with-wix-cli.md) - Admin access to your Wix account (required for API key generation) - Admin access to the GitHub repository > **Note:** You can also [set up Git Integration & Wix CLI](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/set-up-git-integration-with-wix-cli.md#step-2--set-up-your-local-environment) locally for testing. ## Step 1 | Generate an API key An API key allows GitHub Actions to authenticate with your Wix account and perform CLI operations on your sites. To generate an API key: 1. Go to the [API Keys Manager](https://manage.wix.com/account/api-keys) 2. Click **Generate API Key** 3. Select the **Wix CLI - Git Integration** permission 4. Copy and securely store the generated key > **Important:** Keep your API key secure and never commit it directly to your repository. ## Step 2 | Store the API key as a GitHub secret Visit the site's GitHub repo and [create a repository secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) to store the API key. This makes your API key available to use securely in the repo's GitHub Actions workflows. ## Step 3 | Set up the CLI in the GitHub Actions workflow Configure the GitHub Actions workflow to set up and authenticate the Wix CLI: 1. In the GitHub Actions workflow, [set up the Wix CLI](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/set-up-git-integration-with-wix-cli.md#set-up-git-integration-with-wix-cli) by including the following command: ```sh npm install ``` 2. Next, authenticate it by including the following command: ```sh npm run wix login -- --api-key ${{ secrets.WIX_CLI_API_KEY }} ``` ## Step 4 | Include CLI commands The workflow can now run authenticated Wix CLI commands to interact with the site. For example: - Include `npm run wix preview` in the workflow to [build a preview version of the site](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/wix-cli-commands.md#wix-preview) based on the current branch. You can set up a workflow to create a preview version whenever a new PR is created. - Include `npm run wix publish` in the workflow to [publish the site](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/wix-cli-commands.md#wix-publish) based on the repo's default branch. You can set up a workflow whenever a PR is merged to the default branch. ## See also - [About Automated Workflows and the Wix CLI](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/about-automated-workflows-and-the-wix-cli.md) - [Wix CLI Commands](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/developer-environments/ides/git-integration/wix-cli-commands.md) - [Generate an API Key](https://dev.wix.com/docs/go-headless/getting-started/setup/authentication/generate-an-api-key-for-admins.md) - [Using Secrets in GitHub Actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)