Skip to content

Commit

Permalink
Fix SHA when workflow run manually
Browse files Browse the repository at this point in the history
  • Loading branch information
alstr committed Oct 27, 2022
1 parent eb4306a commit 216450e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,12 @@ def _should_ignore(self, file):
if __name__ == "__main__":
# Create a basic client for communicating with GitHub, automatically initialised with environment variables.
client = GitHubClient()
# Check to see if the workflow has been run manually.
# If so, adjust the client SHA and diff URL to use the manually supplied inputs.
manual_commit_ref = os.getenv('MANUAL_COMMIT_REF')
manual_base_ref = os.getenv('MANUAL_BASE_REF')
if manual_commit_ref:
client.sha = manual_commit_ref
if manual_commit_ref and manual_base_ref:
print(f'Manually comparing {manual_base_ref}...{manual_commit_ref}')
client.diff_url = f'{client.repos_url}{client.repo}/compare/{manual_base_ref}...{manual_commit_ref}'
Expand Down

0 comments on commit 216450e

Please sign in to comment.