mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
parent
4fcac8cc35
commit
223e23516d
16
.github/workflows/workflow.yml
vendored
16
.github/workflows/workflow.yml
vendored
@ -1,5 +1,14 @@
|
||||
name: "Workflow"
|
||||
on: ["push"]
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
BASE_MANUAL:
|
||||
description: "The base SHA"
|
||||
required: true
|
||||
HEAD_MANUAL:
|
||||
description: "The head SHA"
|
||||
required: false
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-latest"
|
||||
@ -8,5 +17,10 @@ jobs:
|
||||
- name: "TODO to Issue"
|
||||
uses: "alstr/todo-to-issue-action@master"
|
||||
id: "todo"
|
||||
env:
|
||||
BASE_MANUAL:
|
||||
${{ inputs.BASE_MANUAL }}
|
||||
HEAD_MANUAL:
|
||||
${{ inputs.HEAD_MANUAL }}
|
||||
with:
|
||||
PROJECTS_SECRET: ${{ secrets.PROJECTS_SECRET }}
|
||||
|
||||
10
main.py
10
main.py
@ -50,7 +50,7 @@ class GitHubClient(object):
|
||||
self.repo = os.getenv('INPUT_REPO')
|
||||
self.before = os.getenv('INPUT_BEFORE')
|
||||
self.sha = os.getenv('INPUT_SHA')
|
||||
self.commits = json.loads(os.getenv('INPUT_COMMITS'))
|
||||
self.commits = json.loads(os.getenv('INPUT_COMMITS')) or []
|
||||
self.diff_url = os.getenv('INPUT_DIFF_URL')
|
||||
self.token = os.getenv('INPUT_TOKEN')
|
||||
self.issues_url = f'{self.repos_url}{self.repo}/issues'
|
||||
@ -646,6 +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}'
|
||||
if client.diff_url or len(client.commits) != 0:
|
||||
# Get the diff from the last pushed commit.
|
||||
last_diff = StringIO(client.get_last_diff())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user