mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
Replace /compare with /commits to fetch the last diff
This commit is contained in:
parent
12e626ea05
commit
c159a716fd
@ -12,10 +12,6 @@ inputs:
|
||||
description: "The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set)"
|
||||
required: true
|
||||
default: "${{ github.repository }}"
|
||||
BEFORE:
|
||||
description: "The SHA of the last pushed commit (automatically set)"
|
||||
required: true
|
||||
default: "${{ github.event.before }}"
|
||||
SHA:
|
||||
description: "The SHA of the latest commit (automatically set)"
|
||||
required: true
|
||||
|
||||
9
main.py
9
main.py
@ -48,7 +48,6 @@ class GitHubClient(object):
|
||||
|
||||
def __init__(self):
|
||||
self.repo = os.getenv('INPUT_REPO')
|
||||
self.before = os.getenv('INPUT_BEFORE')
|
||||
self.sha = os.getenv('INPUT_SHA')
|
||||
self.token = os.getenv('INPUT_TOKEN')
|
||||
self.issues_url = f'{self.repos_url}{self.repo}/issues'
|
||||
@ -62,12 +61,8 @@ class GitHubClient(object):
|
||||
self._get_existing_issues()
|
||||
|
||||
def get_last_diff(self):
|
||||
"""Get the last diff based on the SHA of the last two commits."""
|
||||
if not self.before or self.before.startswith('000000'):
|
||||
# Last commit SHA is empty which means this is the first commit of the branch
|
||||
diff_url = f'{self.repos_url}{self.repo}/commits/{self.sha}'
|
||||
else:
|
||||
diff_url = f'{self.repos_url}{self.repo}/compare/{self.before}...{self.sha}'
|
||||
"""Get the last commit diff."""
|
||||
diff_url = f'{self.repos_url}{self.repo}/commits/{self.sha}'
|
||||
diff_headers = {
|
||||
'Accept': 'application/vnd.github.v3.diff',
|
||||
'Authorization': f'token {self.token}'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user