Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 10, 2025

This PR implements automated PR commenting functionality that provides direct links to Docker images built for pull requests. When a PR modifies base image files (Dockerfile, package.json, etc.), the CI system now automatically creates or updates a comment with the Docker image details.

Changes Made

Workflow Enhancement

Added a new comment_docker_image job to .github/workflows/on_pr_test.yaml that:

  • Runs after successful base image build when changes are detected
  • Creates or updates PR comments idempotently (no duplicates)
  • Uses minimal required permissions (pull-requests: write)
  • Only executes for actual pull request events

Comment Features

The automated comment includes:

  • Direct link to the Docker image: ghcr.io/orionrobots/orionrobots-site.base:${PR_NUMBER}
  • Copy-paste ready commands for pulling and using the image
  • Clear context about how to use it for local development
  • Visual indicator (🐳) for easy identification

Documentation

Added comprehensive documentation in .github/scripts/README.md covering:

  • How the automation works
  • Benefits for reviewers and contributors
  • Troubleshooting guidance
  • Security and permissions model

Example Comment

## 🐳 Docker Base Image Available

A new base Docker image has been built and pushed for this PR:

**Image:** `ghcr.io/orionrobots/orionrobots-site.base:123`

### How to use this image:

```bash
# Pull the image
docker pull ghcr.io/orionrobots/orionrobots-site.base:123

# Run with the image
docker run -it ghcr.io/orionrobots/orionrobots-site.base:123 bash

## Benefits
- **Convenience**: Reviewers can quickly access Docker images without searching through workflows
- **Efficiency**: No need to dig through GitHub Package registry or workflow logs
- **Clarity**: Clear usage instructions included in every comment
- **Maintainability**: Idempotent updates prevent comment spam

## Compatibility
- Works with internal PRs and handles fork limitations appropriately
- Maintains existing workflow functionality without disruption
- Uses secure, minimal GitHub token permissions

Fixes #257.

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/orionrobots/orionrobots.github.io/issues/new?title=✨Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: dannystaple <426859+dannystaple@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Automate PR comments with Docker image link after base image push Automate PR comments with Docker image link after base image push Aug 10, 2025
@Copilot Copilot AI requested a review from dannystaple August 10, 2025 12:25
Copilot finished work on behalf of dannystaple August 10, 2025 12:25
Copy link
Contributor

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Warnings Elapsed time
❌ ACTION actionlint 5 6 0 0.1s
✅ BASH bash-exec 1 0 0 0.0s
✅ BASH shellcheck 1 0 0 0.06s
⚠️ BASH shfmt 1 1 0 0.0s
❌ C cppcheck 8 8 0 0.31s
❌ CPP cppcheck 8 8 0 0.31s
✅ JSON npm-package-json-lint yes no no 0.44s
✅ JSON v8r 12 0 0 7.17s
❌ MARKDOWN markdown-link-check 738 213 0 32.04s
✅ REPOSITORY gitleaks yes no no 13.94s
✅ REPOSITORY git_diff yes no no 1.43s
❌ REPOSITORY grype yes 2 no 33.61s
✅ REPOSITORY secretlint yes no no 43.56s
✅ REPOSITORY syft yes no no 2.04s
✅ REPOSITORY trivy-sbom yes no no 3.39s
✅ REPOSITORY trufflehog yes no no 4.81s
✅ XML xmllint 1 0 0 192.33s
✅ YAML v8r 13 0 0 6.83s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

Copy link
Contributor

🐳 Docker Base Image Available

A new base Docker image has been built and pushed for this PR:

Image: ghcr.io/orionrobots/orionrobots-site.base:258

How to use this image:

# Pull the image
docker pull ghcr.io/orionrobots/orionrobots-site.base:258

# Run with the image
docker run -it ghcr.io/orionrobots/orionrobots-site.base:258 bash

For local development:

You can use this image as a base for testing changes without rebuilding dependencies.

This comment is automatically updated when the base image is rebuilt.

@dannystaple dannystaple marked this pull request as ready for review August 10, 2025 16:52
@dannystaple dannystaple merged commit 05a4b96 into master Aug 10, 2025
6 checks passed
@dannystaple dannystaple deleted the copilot/fix-257 branch August 10, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants