Skip to content

Commit

Permalink
[Bot] Sealing Alt
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Jan 18, 2024
1 parent 5c3cae7 commit f5d2cad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: C# bot
on:
push:
branches: [ "main", "debug-workflow" ]
paths: ["**.cs"]
paths: ["**.cs", ".github/workflow/bot.yml"]
pull_request:
branches: [ "main" ]
paths: ["**.cs"]
paths: ["**.cs", ".github/workflow/bot.yml"]

defaults:
run:
Expand All @@ -27,14 +27,14 @@ jobs:
- name: Build
run: dotnet publish -c Release -r linux-arm64 --no-self-contained
- name: Upload program
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Bot
path: |
Bot/bin/Release/net8.0/linux-arm64/Bot
Bot/bin/Release/net8.0/linux-arm64/*.dll
Bot/bin/Release/net8.0/linux-arm64/*.json
Bot/bin/Release/net8.0/linux-arm64/runtimes/linux-arm64/
Bot/bin/Release/net8.0/linux-arm64/runtimes/linux-arm64/*.*
inspect:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion Bot/Sql/Alt.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using SQLite;

namespace Hyperstellar.Sql;
internal class Alt

internal sealed class Alt
{
[PrimaryKey, NotNull]
public string AltId { get; set; }

Check warning on line 8 in Bot/Sql/Alt.cs

View workflow job for this annotation

GitHub Actions / inspect

"[UnusedAutoPropertyAccessor.Global] Auto-property accessor 'AltId.get' is never used" on /home/runner/work/Hyperstellar/Hyperstellar/Bot/Sql/Alt.cs(8,124)
Expand Down
21 changes: 17 additions & 4 deletions Bot/hyperstellar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import os
from zipfile import ZipFile

os.environ['DOTNET_ROOT'] = os.environ['HOME'] + '/.dotnet'
try:
os.environ['DOTNET_ROOT'] = os.environ['HOME'] + '/.dotnet'
except KeyError:
pass

RUNS_URL = 'https://api.github.com/repos/Pythonic-Rainbow/Hyperstellar/actions/workflows/81383822/runs'
RUNS_URL = 'https://api.github.com/repos/TCLRainbow/Hyperstellar/actions/workflows/82482571/runs'


def explode(cond, msg):
Expand All @@ -14,7 +17,7 @@ def explode(cond, msg):
os._exit(1)

def build_artifact_url(run_id):
return f'https://api.github.com/repos/Pythonic-Rainbow/Hyperstellar/actions/runs/{run_id}/artifacts'
return f'https://api.github.com/repos/TCLRainbow/Hyperstellar/actions/runs/{run_id}/artifacts'


req = request.Request(RUNS_URL)
Expand All @@ -26,7 +29,17 @@ def build_artifact_url(run_id):
run = result['workflow_runs'][0]
print(f'Checking run: {run["display_title"]}')
explode(run['status'] != 'completed', 'Run is not completed!')
explode(run['conclusion'] != 'success', 'Run failed!')
req = request.Request(run['jobs_url'])
with request.urlopen(req) as resp:
result = json.loads(resp.read())
jobs = result['jobs']
build_ok = False
for job in jobs:
if job['name'] == 'build':
build_ok = True
explode(job['conclusion'] != 'success', 'Build failed!')
break
explode(not build_ok, 'No build job found!')
explode(run['head_branch'] != 'main', 'Branch not main')
explode(run['pull_requests'], 'Triggered by PR')
run_id = run['id']
Expand Down

0 comments on commit f5d2cad

Please sign in to comment.