Adding GitHub Actions - Amazon CodeCatalyst

Amazon CodeCatalyst is in preview release and is subject to change.

Adding GitHub Actions

A GitHub Action is a lot like a CodeCatalyst action, except that it was developed for use with GitHub workflows. For details on GitHub Actions, see the GitHub Actions documentation.

Note

The Lambda compute type does not support GitHub Actions. Docker-based GitHub Actions that are running within the CodeCatalyst GitHub Actions action are also not supported with Lambda compute.

You can use a GitHub Action alongside native CodeCatalyst actions in a CodeCatalyst workflow. There are two ways to add a GitHub Action to a CodeCatalyst workflow:

  • You can select the GitHub Action from a curated list in the CodeCatalyst console. Several popular GitHub Actions are available. For more information, see Adding a curated GitHub Action.

  • If the GitHub Action that you want to use is not available in the CodeCatalyst console, you can add it using a GitHub Actions action.

    A GitHub Actions action is a CodeCatalyst action that wraps a GitHub Action and makes it compatible with CodeCatalyst workflows.

    Here is an example of a GitHub Actions action wrapping the Super-Linter GitHub Action:

    Actions: GitHubAction: Identifier: aws/github-actions-runner@v1 Configuration: Steps: - name: Lint Code Base uses: github/super-linter@v4 env: VALIDATE_ALL_CODEBASE: "true" DEFAULT_BRANCH: main

    In the previous code, the CodeCatalyst GitHub Actions action (identified by aws/github-actions-runner@v1) wraps the Super-Linter action (identified by github/super-linter@v4), making it work in a CodeCatalyst workflow.

    For more information, see Adding the "GitHub Actions" action.

All GitHub Actions—both curated and not—must be wrapped inside a GitHub Actions action (aws/github-actions-runner@v1), as shown in the previous example. The wrapper is required for the action to function properly.

How are GitHub Actions different from CodeCatalyst actions?

GitHub Actions that are used inside a CodeCatalyst workflow do not have the same level of access and integration with AWS and CodeCatalyst features (such as environments and issues) that CodeCatalyst actions do.

Can GitHub Actions interact with other CodeCatalyst actions in the workflow?

Yes. For example, GitHub Actions can use variables produced by other CodeCatalyst actions as input, and can also share output parameters and artifacts with CodeCatalyst actions. For more information, see Working with GitHub Actions output parameters.

Which GitHub Actions can I use?

You can use any GitHub Action available through the CodeCatalyst console, and any GitHub Action available in the GitHub Marketplace. If you decide to use a GitHub Action from the Marketplace, keep in mind the following issues and limitations.

  • GitHub Actions that internally rely on the github context or that reference GitHub-specific resources won't work in CodeCatalyst. For example, the following actions won't work in CodeCatalyst:

    • Actions that attempt to add, change, or update GitHub resources. Examples include actions that update pull requests, or create issues in GitHub.

    • Almost all actions listed in https://github.com/actions.

  • GitHub Actions that are Docker container actions will work, but they must be run by the default Docker user (root). Do not run the action as user 1001. (At the time of writing, user 1001 works in GitHub, but not in CodeCatalyst.) For more information, see the USER topic in Dockerfile support for GitHub Actions.

For a list of available curated actions, use the instructions below.

To obtain a list of curated GitHub Actions
  1. Open the CodeCatalyst console at https://codecatalyst.aws/.

  2. Choose your project.

  3. In the navigation pane, choose CI/CD, and then choose Workflows.

  4. Choose the name of your workflow.

  5. Choose Edit.

  6. Choose Visual.

  7. Choose + Actions.

  8. Under the Actions title, in the drop-down list, choose GitHub.

    A curated selection of GitHub Actions appears.

  9. Browse the collection of GitHub Actions to see which ones are available.

How do I add a GitHub Action (high-level steps)?

The high-level steps to add a GitHub Action to a CodeCatalyst workflow are as follows:

  1. In your CodeCatalyst project, you create a workflow. The workflow is where you define how to build, test, and deploy your application. For more information, see Getting started with workflows in CodeCatalyst.

  2. In the workflow, you add a curated GitHub Action or you add the GitHub Actions action.

  3. You do one of the following:

    • If you chose to add a curated action, configure it. For more information, see Adding a curated GitHub Action.

    • If you chose to add a non-curated action, within the GitHub Actions action, you paste the GitHub Action’s YAML code. You can find this code on the details page of your chosen GitHub Action in the GitHub Marketplace. You will likely need to modify the code slightly to have it work in CodeCatalyst. For more information, see Adding the "GitHub Actions" action.

  4. (Optional) Within the workflow, you add other actions like the build and test actions. For more information, see Build, test, and deploy with workflows in CodeCatalyst.

  5. You start the workflow either manually or automatically through a trigger. The workflow runs the GitHub Action and any other actions in the workflow. For more information, see Manually starting a workflow run.

For detailed steps, see:

Does the GitHub Action run in GitHub?

No. The GitHub Action runs in CodeCatalyst, using CodeCatalyst’s build machines.

Can I use GitHub workflows too?

No.