Get File Content
Platform Note
- •macOS/Linux: run
.shscripts - •Windows: run
.ps1scripts with the same argument order
Run the get-file-content.sh script on macOS/Linux or get-file-content.ps1 on Windows to retrieve file content.
Arguments
| # | Name | Required | Description |
|---|---|---|---|
| 1 | organization | No | Azure DevOps organization (default: default_organization) |
| 2 | project | Yes | Project name or ID |
| 3 | repositoryId | Yes | Repository name or ID |
| 4 | path | Yes | File path in the repo (e.g. /src/app.js) |
| 5 | version | No | Version string – commit SHA, branch name, or tag |
| 6 | versionType | No | Version type: branch, commit, or tag (default: branch) |
Example
bash
# Get file from a specific branch bash .github/skills/get-file-content/get-file-content.sh default_organization MyProject MyRepo /src/app.js main branch # Get file from a specific commit bash .github/skills/get-file-content/get-file-content.sh default_organization MyProject MyRepo /src/app.js abc123 commit
powershell
# Get file from a specific branch (Windows) .\github\skills\get-file-content\get-file-content.ps1 default_organization MyProject MyRepo /src/app.js main branch # Get file from a specific commit (Windows) .\github\skills\get-file-content\get-file-content.ps1 default_organization MyProject MyRepo /src/app.js abc123 commit
Output
Returns JSON with content containing the file's text content, plus metadata like path, commitId, and objectId.