diff --git a/rdgenerator/migrations/0002_githubrun_github_run_id.py b/rdgenerator/migrations/0002_githubrun_github_run_id.py new file mode 100644 index 0000000..ddcb655 --- /dev/null +++ b/rdgenerator/migrations/0002_githubrun_github_run_id.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2026-03-11 04:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('rdgenerator', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='githubrun', + name='github_run_id', + field=models.BigIntegerField(blank=True, null=True), + ), + ] diff --git a/rdgenerator/models.py b/rdgenerator/models.py index 2c04e2e..7498bbd 100644 --- a/rdgenerator/models.py +++ b/rdgenerator/models.py @@ -5,4 +5,3 @@ class GithubRun(models.Model): uuid = models.CharField(verbose_name="uuid", max_length=100) status = models.CharField(verbose_name="status", max_length=100) github_run_id = models.BigIntegerField(null=True, blank=True) - created_at = models.DateTimeField(auto_now_add=True) diff --git a/rdgenerator/views.py b/rdgenerator/views.py index 94639a6..99df6fe 100644 --- a/rdgenerator/views.py +++ b/rdgenerator/views.py @@ -348,8 +348,6 @@ def check_for_file(request): headers = {"Authorization": f"Bearer {_settings.GHBEARER}"} api_url = f"https://api.github.com/repos/{_settings.GHUSER}/{_settings.REPONAME}/actions/runs/{gh_run.github_run_id}" github_log_url = f"https://github.com/{_settings.GHUSER}/{_settings.REPONAME}/actions/runs/{gh_run.github_run_id}" - - timeout_limit = gh_run.created_at + timedelta(hours=2) try: gh_response = requests.get(api_url, headers=headers) @@ -396,6 +394,13 @@ def get_png(request): return response +def create_github_run(myuuid): + new_github_run = GithubRun( + uuid=myuuid, + status="Starting generator...please wait" + ) + new_github_run.save() + def update_github_run(request): data = json.loads(request.body) myuuid = data.get('uuid')