Insert a File

To insert a file, the XML that you construct should look similar to the following example.

<insertXML>
    <insert>
        <reference>FileInsert</reference>
        <property name="Organization" value="OrgName"/>
        <property name="Repository" value="RepoName"/>
        <property name="Branch" value="BranchName"/>
        <property name="File" value="Folder/InsertFile.cpp"/>
        <property name="Type" value="File"/>
        <xmlmetadata>
            <commitMessage>Test commit</commitMessage>
            <author>
                <name>Author Name</name>
                <email>author@example.com</email>
            </author>
            <committer>
                <name>Committer Name</name>
                <email>committer@example.com</email>
            </committer>
        </xmlmetadata>
        <file>
            <type>file</type>
            <content>C:/Users/Documents/Folder/InsertFile.cpp</content>
        </file>
    </insert>
</insertXML>

Properties for inserting a file

Name Required Type Description
Organization Yes String The name of the organization that owns the repository.
Repository Yes String The name of the repository in which to insert the file.
Branch Yes String The name of the branch in which to insert the file.
File Yes String The path, in the repository, where you want to insert the file. If this matches an existing file, it is overwritten.
Type Yes String To insert a file, specify "File".

Metadata fields for files

Field Path Required Type Description
commitMessage Yes String The commit message to use.
author/name No String The name of the file author.
author/email No String The e-mail address of the file author.
committer/name No String The name of the user who will appear to have committed the file.
committer/email No String The e-mail address of the user who will appear to have committed the file.

For information about how to specify the file content, see the documentation for the insert action in the GitHub Connector Reference.