Supercharge your workflow with the GitHub Raw Downloader Action! 💪 Download files from any GitHub repository with ease and flexibility. Whether you're fetching configuration files, scripts, or any other assets, this action has got you covered. 🎯
- 📥 Download files from any GitHub repository
- 🔐 Support for private repositories with token authentication
- 🔀 Flexible file path mapping
- 🧩 Environment variable expansion in paths
- 📊 Detailed metadata output for each downloaded file
- 🚦 Progress tracking with debug messages
Name | Description | Required | Default |
---|---|---|---|
github-token |
GitHub token for accessing private repositories | No | ${{ github.token }} |
repo |
Repository to download from (org/repo) | No | ${{ github.repository }} |
ref |
Git reference (branch, tag, or commit SHA) | No | master |
pre |
Whether to run in pre action phase | No | false |
files |
Files to download (multi-line string) | Yes | N/A |
output-directory |
Directory to store downloaded files | No | . |
Name | Description |
---|---|
metadata |
JSON string containing metadata for all downloaded files |
Here's an example of how to use the GitHub Raw Downloader Action in your workflow:
steps:
- name: Download files from GitHub raw
uses: your-username/ghrawnloader@v1
id: downloader
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repo: octocat/Hello-World
ref: main
files: |
README.md => docs/README.md
src/app.js => app.js
config/${ENV_NAME}.json => config.json
output-directory: downloaded-files
- name: Use downloaded files
run: |
cat downloaded-files/docs/README.md
node downloaded-files/app.js
- name: Use metadata
run: |
echo 'Metadata: ${{ steps.downloader.outputs.metadata }}'
# Parse and use the metadata as needed
The action provides detailed metadata for each downloaded file. Here's an example of the metadata output format:
[
{
"srcPath": "README.md",
"destPath": "/path/to/downloaded-files/docs/README.md",
"repo": "octocat/Hello-World",
"ref": "main",
"size": 1234,
"humanSize": "1.23 KB",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"timeTaken": 42
},
{
"srcPath": "src/app.js",
"destPath": "/path/to/downloaded-files/app.js",
"repo": "octocat/Hello-World",
"ref": "main",
"size": 5678,
"humanSize": "5.68 KB",
"sha256": "7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730",
"timeTaken": 78
}
]
You can use advanced file path mapping in the files
input:
files: |
org/repo@ref : source/path.txt => destination/path.txt
: config.json => ${HOME}/config.json
@develop : scripts/build.sh => ~/scripts/build.sh => 755
- Specify a different repo and ref for each file
- Use environment variable expansion in destination paths
- Set file permissions (octal) after the destination path
To access private repositories, make sure to provide a valid github-token
with appropriate permissions.
I welcome contributions!
This project is licensed under the GPL 3.0 License - see the LICENSE file for details.
Give a ⭐️ if this project helped you!