mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-25 15:22:59 +00:00
16
.github/workflows/workflow.yml
vendored
16
.github/workflows/workflow.yml
vendored
@@ -1,5 +1,14 @@
|
|||||||
name: "Workflow"
|
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:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
@@ -8,5 +17,10 @@ jobs:
|
|||||||
- name: "TODO to Issue"
|
- name: "TODO to Issue"
|
||||||
uses: "alstr/todo-to-issue-action@master"
|
uses: "alstr/todo-to-issue-action@master"
|
||||||
id: "todo"
|
id: "todo"
|
||||||
|
env:
|
||||||
|
BASE_MANUAL:
|
||||||
|
${{ inputs.BASE_MANUAL }}
|
||||||
|
HEAD_MANUAL:
|
||||||
|
${{ inputs.HEAD_MANUAL }}
|
||||||
with:
|
with:
|
||||||
PROJECTS_SECRET: ${{ secrets.PROJECTS_SECRET }}
|
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.repo = os.getenv('INPUT_REPO')
|
||||||
self.before = os.getenv('INPUT_BEFORE')
|
self.before = os.getenv('INPUT_BEFORE')
|
||||||
self.sha = os.getenv('INPUT_SHA')
|
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.diff_url = os.getenv('INPUT_DIFF_URL')
|
||||||
self.token = os.getenv('INPUT_TOKEN')
|
self.token = os.getenv('INPUT_TOKEN')
|
||||||
self.issues_url = f'{self.repos_url}{self.repo}/issues'
|
self.issues_url = f'{self.repos_url}{self.repo}/issues'
|
||||||
@@ -646,6 +646,14 @@ class TodoParser(object):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Create a basic client for communicating with GitHub, automatically initialised with environment variables.
|
# Create a basic client for communicating with GitHub, automatically initialised with environment variables.
|
||||||
client = GitHubClient()
|
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:
|
if client.diff_url or len(client.commits) != 0:
|
||||||
# Get the diff from the last pushed commit.
|
# Get the diff from the last pushed commit.
|
||||||
last_diff = StringIO(client.get_last_diff())
|
last_diff = StringIO(client.get_last_diff())
|
||||||
|
|||||||
Reference in New Issue
Block a user