This will commit a file directly on GitHub via the API
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.
|Supported platforms||ios, android, mac|
|Returns||A hash containing all relevant information for this commit
Access things like 'html_url', 'sha', 'message'
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" )
||The path to your repo, e.g. 'fastlane/fastlane'|
||The server url. e.g. 'https://your.internal.github.host/api/v3' (Default: 'https://api.github.com')||
||Personal API Token for GitHub - generate one at https://github.com/settings/tokens||*|
||Use a Bearer authorization token. Usually generated by Github Apps, e.g. GitHub Actions GITHUB_TOKEN environment variable|
||The branch that the file should be committed on (default: master)||
||The relative path to your file from project root e.g. assets/my_app.xcarchive|
||The commit message. Defaults to the file name||*|
||Optionally disable secure requests (ssl_verify_peer)||
* = default value is dependent on the user's system
Actions can communicate with each other using a shared hash
lane_context, that can be accessed in other actions, plugins or your lanes:
commit_github_file action generates the following Lane Variables:
||Link to your committed file|
||Commit SHA generated|
||The whole commit JSON object response|
To get more information check the Lanes documentation.
To show the documentation in your terminal, run
fastlane action commit_github_file
It is recommended to add the above action into your
Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal
fastlane run commit_github_file
To pass parameters, make use of the
: symbol, for example
fastlane run commit_github_file parameter1:"value1" parameter2:"value2"
It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g.
param:"1,2,3"). Hashes are not currently supported.
It is recommended to add all fastlane actions you use to your
This action, just like the rest of fastlane, is fully open source, view the source code on GitHub