Skip to main content
Learn how to integrate a reusable custom Docker container action across repositories. In this guide, we’ll invoke the docker-action-pr-giphy-comment action from the solar-system project to post a thank-you GIF on pull requests.
The image shows a GitHub repository page for "docker-action-pr-giphy-comment," displaying files and recent commits.

1. Open the Target Repository

Navigate to your solar-system repository on GitHub:
This image shows a GitHub repository page named "solar-system" with various files and folders listed, including workflows, images, and JavaScript files. The repository has no stars or forks and includes a recent pull request merge.

2. Add the Giphy API Token

Your custom action fetches GIFs using the Giphy API. To configure:
  1. Get an API key from the Giphy Developer Portal.
  2. In your repo, go to Settings > Actions > Secrets and variables > Actions.
  3. Click New repository secret.
  4. Name it GIPHY_API and paste the API key.
  5. Save.
The image shows a GitHub repository settings page focused on "Actions secrets and variables," displaying options for managing environment and repository secrets.
The image shows a GitHub repository settings page where a new secret is being added under "Actions secrets," with the name "GIPHY_API" and a secret key entered.
Never expose your API keys in plain text. Always use GitHub Secrets for sensitive values.

3. Create the Workflow File

Checkout a branch (e.g., main or a feature branch) and add .github/workflows/pr-thank-you.yml:
The image shows a GitHub interface where a user is creating or editing a file named "pr-thank" in the ".github/workflows" directory of a repository. The file content area is currently empty.

Workflow Configuration

Permissions Reference

Commit and push your branch, then open a pull request:
The image shows a GitHub interface for creating a pull request, with options to leave a comment and assign reviewers. The "Create pull request" button is highlighted at the bottom.

4. Observe the Workflow Run

Once the PR is created, GitHub Actions will trigger the workflow automatically:
The image shows a GitHub pull request page for creating a file named "pr-thank-you.yml" with details about the branch, checks, and merge status.
Monitor progress under the Actions tab:
The image shows a GitHub Actions page with a workflow named "pr-thank-you.yml" in progress. The sidebar lists options like Caches, Deployments, and Runners.
After success, the action posts a thank-you GIF comment on the pull request.

5. Behind the Scenes: Docker Build Logs

Each run of a container action rebuilds the Docker image. Example build output:
And the execution command:
Rebuilding the Docker image each run adds latency. For faster CI workflows, consider authoring a JavaScript action that executes without a container build.

References

Watch Video