def commit_file(file_name, repo, environment):
#The index of the repo is used to add the spdx file to be committed.
index = repo.index
#Add the SPDX file to be committed
index.add([file_name])
repo.git.add(file_name)
#Set the author, committer, and commit message.
author = Actor(environment['git_name'], environment['git_email'])
committer = Actor(environment['git_name'], environment['git_email'])
commit_message = environment['git_commit_message']
#Get the head commit
head_commit = str(repo.head.commit)
#Make the commit locally of the new SPDX file
index.commit(commit_message, author=author, committer=committer)
评论列表
文章目录