From 9892cd9a3f31757cd004ec218e2843601a678eb7 Mon Sep 17 00:00:00 2001 From: alyssa Date: Fri, 6 Sep 2024 16:25:25 +0900 Subject: [PATCH] test --- .github/workflows/ci.yml | 2 +- ci/run_ci.py | 4 ++-- ci/spawn_jobs.py | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37b7d3e0..df2d7376 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: GITHUB_APP_TOKEN: ${{ secrets.COMMIT_STATUS_TOKEN }} DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - CUR_SHA: ${{ github.sha }} + GIT_SHA: ${{ github.sha }} REPO_URL: https://github.com/${{ github.repository }} OLD_SHA: ${{ github.event.before }} diff --git a/ci/run_ci.py b/ci/run_ci.py index 570e4bef..0ab460fa 100644 --- a/ci/run_ci.py +++ b/ci/run_ci.py @@ -50,11 +50,11 @@ def report_status(name, start_time, exit=None): 'Authorization': f'Bearer {must_get_env("GITHUB_APP_TOKEN")}', 'content-type':'application/json' }, - data=json.dumps(data) + data=bytes(json.dumps(data), 'UTF-8') ) try: - with urllib.request.urlopen(request) as response: + with urllib.request.urlopen(req) as response: response_code = response.getcode() response_data = response.read() print(f"{response_code} updated status {data}: {response_data}") diff --git a/ci/spawn_jobs.py b/ci/spawn_jobs.py index 68ba1929..839dd6f4 100755 --- a/ci/spawn_jobs.py +++ b/ci/spawn_jobs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import os, sys, json, subprocess, random, time +import os, sys, json, subprocess, random, time, re import urllib.request def must_get_env(name): @@ -22,18 +22,18 @@ def spawn_job(name): 'Authorization': f'Bearer {must_get_env("GITHUB_APP_TOKEN")}', 'content-type':'application/json' }, - data=json.dumps({ + data=bytes(json.dumps({ 'ref': must_get_env("GIT_SHA"), 'inputs': { 'dispatchData': json.dumps({ 'action': name, }) } - }) + }), 'UTF-8') ) try: - with urllib.request.urlopen(request) as response: + with urllib.request.urlopen(req) as response: response_code = response.getcode() response_data = response.read() print(f"{response_code} spawned job {name}: {response_data}") @@ -79,16 +79,16 @@ def create_jobs(): jobs = jobs | ["format_cs", "format_rs"] else: for key in modify_regexes.keys(): - if re.match(key, changed_file, flags=re.MULTILINE) is not None: - jobs = jobs | modify_regexes[key] + if re.match(key, str(changed_files), flags=re.MULTILINE) is not None: + jobs = jobs | set(modify_regexes[key]) - for key in changes: + for key in jobs: if aliases.get(key) is not None: - jobs = jobs | aliases[key] - jobs = jobs - [key] + jobs = jobs | set(aliases[key]) + jobs = jobs - set([key]) # test - jobs = jobs | ["test"] + jobs = jobs | set(["test"]) # do this in a tx or something for job in jobs: