ghas-guardrails-demo, which contains multiple images for a product demo. Manually optimizing many files can be time consuming; a GitHub App can scan the repo, optimize images, and open a pull request (PR) with the changes for review.

Why use an automation app?
- Saves time: bulk-optimizes large numbers of images.
- Preserves history: changes are proposed via PRs so you can review and merge.
- Improves performance: smaller images reduce repo size and web load times.
- Repeatable: runs automatically when new images are added.
Choose a Marketplace app
Open the GitHub Marketplace (for example,https://github.com/marketplace) and search for an image optimization app. For this demo we use Imgbot, which analyzes image files in your repository and compresses them to reduce size while preserving visual quality.

Open-source tiers typically operate only on public repositories. If you need optimization for private repositories, review the app’s pricing and billing options before installing.
Install and configure the app
During installation you can limit the app to specific repositories within an organization. In this example we install Imgbot into thegame-devstudio organization and restrict it to the ghas-guardrails-demo repository. The installer displays requested permissions such as read access to repository metadata and read/write access to code and pull requests so the app can modify images and create PRs.

Granting write access lets the app create commits and pull requests. Only install apps from trusted vendors and verify the permissions requested before authorizing.


Review the automated pull request
It may take several minutes for the app to finish scanning and create a pull request. When Imgbot raises the PR, review the changes: the PR summary typically lists each optimized image, the original size, the optimized size, and the percent reduction — plus an overall reduction metric. In this demo the total reduction shown is about 7%.![A dark-themed GitHub pull request page for "ghas-guardrail-demo" showing an ImgBot PR titled "[ImgBot] Optimize images #8" with a bot comment "Beep boop. Your images are optimized!" and a table listing before/after file sizes and percent reductions.](https://mintcdn.com/kodekloud-c4ac6d9a/BC9OpZkYKTZqO9jv/images/GitHub-Administration-Certification/Security-and-Compliance/Demo-Configure-GitHub-Apps/ghas-guardrail-demo-imgbot-pr-optimized.jpg?fit=max&auto=format&n=BC9OpZkYKTZqO9jv&q=85&s=1b7c8e2c87d4c0bf85f50d4d3d700334)
- Confirm the PR contains only image changes as expected.
- Spot-check a few optimized images visually to ensure quality.
- Verify the diff shows size reductions and no unintended metadata changes.
- Merge the PR when you’re satisfied.
Troubleshooting & tips
- If the app doesn’t run, check the organization’s billing and app installation scope.
- For private repos, confirm the plan supports private repository optimization.
- If you want different compression settings, check the app’s configuration options or repository-level config files the app supports.
Links and references
- Imgbot on GitHub Marketplace: https://github.com/marketplace/imgbot
- GitHub Marketplace: https://github.com/marketplace
- Managing GitHub Apps: https://docs.github.com/en/developers/apps/overview-of-apps