Integrating GitHub Actions into a workflow - Amazon CodeCatalyst

Integrating GitHub Actions into a workflow

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

You can use GitHub Actions 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 Exporting a GitHub output parameter so that other actions can use it and Referencing a GitHub output parameter.

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 limitations.

Limitations of GitHub Actions in CodeCatalyst

  • 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 GitHub Actions available through the CodeCatalyst console, see Adding a curated GitHub Action.

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.

  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 Starting a workflow run manually.

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.