From eb4306a7057850abecfb01fa6fcc7bf32ca3008f Mon Sep 17 00:00:00 2001 From: alstr Date: Thu, 27 Oct 2022 10:10:19 +0100 Subject: [PATCH] Update input names --- .github/workflows/workflow.yml | 16 ++++++++-------- main.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 204ab71..c400a5c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -3,11 +3,11 @@ on: push: workflow_dispatch: inputs: - BASE_MANUAL: - description: "The base SHA" + MANUAL_COMMIT_REF: + description: "The SHA of the commit to get the diff for" required: true - HEAD_MANUAL: - description: "The head SHA" + MANUAL_BASE_REF: + description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here" required: false jobs: build: @@ -18,9 +18,9 @@ jobs: uses: "alstr/todo-to-issue-action@master" id: "todo" env: - BASE_MANUAL: - ${{ inputs.BASE_MANUAL }} - HEAD_MANUAL: - ${{ inputs.HEAD_MANUAL }} + MANUAL_COMMIT_REF: + ${{ inputs.MANUAL_COMMIT_REF }} + MANUAL_BASE_REF: + ${{ inputs.MANUAL_BASE_REF }} with: PROJECTS_SECRET: ${{ secrets.PROJECTS_SECRET }} diff --git a/main.py b/main.py index 0b472b8..7bd6387 100644 --- a/main.py +++ b/main.py @@ -646,14 +646,14 @@ class TodoParser(object): if __name__ == "__main__": # Create a basic client for communicating with GitHub, automatically initialised with environment variables. client = GitHubClient() - base_manual = os.getenv('BASE_MANUAL') - head_manual = os.getenv('HEAD_MANUAL') - if base_manual and head_manual: - print(f'Manually comparing {base_manual}...{head_manual}') - client.diff_url = f'{client.repos_url}{client.repo}/compare/{base_manual}...{head_manual}' - elif base_manual: - print(f'Manual checking {base_manual}') - client.diff_url = f'{client.repos_url}{client.repo}/commits/{base_manual}' + manual_commit_ref = os.getenv('MANUAL_COMMIT_REF') + manual_base_ref = os.getenv('MANUAL_BASE_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}' + elif manual_commit_ref: + print(f'Manual checking {manual_commit_ref}') + client.diff_url = f'{client.repos_url}{client.repo}/commits/{manual_commit_ref}' if client.diff_url or len(client.commits) != 0: # Get the diff from the last pushed commit. last_diff = StringIO(client.get_last_diff())