commit_github_file
Community Action Reference: Inspected directly from Fastlane core ruby gem definitions.
Supported Platforms: ios, android, mac
This will commit a file directly on GitHub via the API
Details
Commits a file directly to GitHub. You must provide your GitHub Personal token (get one from https://github.com/settings/tokens/new), the repository name and the relative file path from the root git project. Out parameters provide the commit sha created, which can be used for later usage for examples such as releases, the direct download link and the full response JSON. Documentation: https://developer.github.com/v3/repos/contents/#create-a-file.
Parameters & Options
Total options available: 8
| Key | Type | Env Variable | Default | Required | Description |
|---|---|---|---|---|---|
repository_name |
String |
FL_COMMIT_GITHUB_FILE_REPOSITORY_NAME |
- |
Yes | The path to your repo, e.g. ‘fastlane/fastlane’ |
server_url |
String |
FL_COMMIT_GITHUB_FILE_SERVER_URL |
https://api.github.com |
No | The server url. e.g. ‘https://your.internal.github.host/api/v3’ (Default: ‘https://api.github.com’) |
api_token |
String |
FL_COMMIT_GITHUB_FILE_API_TOKEN |
- |
No | Personal API Token for GitHub - generate one at https://github.com/settings/tokens |
api_bearer |
String |
FL_COMMIT_GITHUB_FILE_API_BEARER |
- |
No | Use a Bearer authorization token. Usually generated by GitHub Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable |
branch |
String |
FL_COMMIT_GITHUB_FILE_BRANCH |
master |
No | The branch that the file should be committed on (default: master) |
path |
String |
FL_COMMIT_GITHUB_FILE_PATH |
- |
Yes | The relative path to your file from project root e.g. assets/my_app.xcarchive |
message |
String |
FL_COMMIT_GITHUB_FILE_MESSAGE |
- |
No | The commit message. Defaults to the file name |
secure |
Fastlane::Boolean |
FL_COMMIT_GITHUB_FILE_SECURE |
true |
No | Optionally disable secure requests (ssl_verify_peer) |
Lane Context Shared Values
This action writes the following values to Actions.lane_context[SharedValues::...]:
| Key | Description |
|---|---|
SharedValues::COMMIT_GITHUB_FILE_HTML_LINK |
Link to your committed file |
SharedValues::COMMIT_GITHUB_FILE_SHA |
Commit SHA generated |
SharedValues::COMMIT_GITHUB_FILE_JSON |
The whole commit JSON object response |
Examples
response = commit_github_file( repository_name: "fastlane/fastlane", server_url: "https://api.github.com", api_token: ENV["GITHUB_TOKEN"], message: "Add my new file", branch: "master", path: "assets/my_new_file.xcarchive")Source & Upstream
- Gem Action:
commit_github_file.rb - Upstream Source: Inspect Ruby Implementation on GitHub
- Authors:
tommeier