Add cross-platform support for Windows and macOS runners
This PR implements cross-platform compatibility to resolve the "Container action is only supported on Linux" error when running on Windows runners.
Problem
Previously, this action used runs.using: docker which only works on Linux runners. Users trying to run the action on Windows or macOS runners would get:
Error: Container action is only supported on Linux
Solution
Changed the action from a Docker action to a composite action that uses docker run directly, enabling it to work on any runner with Docker installed.
Key Changes
-
action.yml: Changed fromdockertocompositeaction type with proper environment variable mapping -
run.sh: New cross-platform wrapper script that:- Detects the operating system
- Checks Docker availability with helpful error messages
- Executes the same Docker image using
docker run - Passes all environment variables and inputs correctly
- Automatically pulls the image if not present locally
-
README.md: Updated documentation highlighting cross-platform support and Windows setup requirements
Platform Support
- ✅ Linux runners: Fully supported (existing functionality preserved)
- ✅ Windows runners: Now supported with Docker Desktop/Rancher Desktop
- ✅ macOS runners: Now supported with Docker installed
Usage Example
jobs:
commit-changes:
runs-on: windows-latest # Now works!
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Commit changes
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: "Cross-platform commit from Windows"
Backward Compatibility
✅ Existing Linux workflows continue to work unchanged - same Docker image, same environment, same behavior.
Implementation Details
The solution maintains the exact same execution environment by:
- Using the identical Docker image (
devopsinfra/action-commit-push:v0.10.0) - Preserving all environment variables and volume mounts
- Keeping the same working directory (
/github/workspace) - Running the same
entrypoint.shscript inside the container
The only difference is how the Docker container is invoked:
- Before: GitHub Actions handles Docker execution (Linux only)
- After: Wrapper script handles Docker execution (cross-platform)
Fixes #103.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.launchpad.net
- Triggering command:
/usr/bin/python3 /usr/bin/add-apt-repository ppa:git-core/ppa(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to my firewall allow list
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.