When GitLab Commit pushed - Add new record to Sources tab on Entity View

You will need to add a web hook to your GitLab repository. Please check this article to learn how to do that.

JavaScript for action:

const branch = args.body.ref;
// Branch is smth like `refs/heads/us12355`
const match = branch.match(/^refs\/heads\/us(\d+)/);

if (match && isFinite(match[1])) {
    const entityId = parseInt(match[1]);
    const commands = args.body.commits.map(commit => {
      return {
        command: "targetprocess:CreateResource",
        payload: {
          resourceType: "Revision",
          fields: {
            Project: {Id: 994},
            SourceControlId: commit.id,
            Description: commit.message,
            CommitDate: commit.timestamp,
            Assignables: {
              Items: [{Id: entityId}]
            },
            RevisionFiles: {
              Items: commit.added.map(addedName => ({
                FileName: addedName,
                FileAction: "Add"              
              }))
            }
          }
        }
      };
    });
    return commands;
}