Skip to content

Commit

Permalink
Add CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Svensson committed May 9, 2022
1 parent 9985bbc commit c173fd2
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/weeklies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Weekly Demos

on: [push, workflow_dispatch]
#on:
# schedule:
# - cron: '30 23 * * 1,3,0'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Checkout Matchstats
uses: actions/checkout@v3
with:
fetch-depth: 1
repository: qw-ctf/matches
path: matches

- name: Generate matchstats
run: |
curl -O https://raw.githubusercontent.com/qw-ctf/ktx-stats/master/ktx-stats.py
cd matches
for demo in weeklies/*.mvd.gz; do
statsfile=${demo/mvd.gz/json}
if [[ ! -e ../$statsfile ]]; then
git lfs pull --include="$(printf %q $demo)"
gunzip $demo
python ../ktx-stats.py ${demo/.gz/}
mv $statsfile ../weeklies
fi
done
- name: Push changes
id: push-changes
run: |
git config --global user.name 'Stats Extractor'
git config --global user.email '[email protected]'
git status
git add weeklies
if git commit -am "Weekly demos"; then
hash=$(git rev-parse --verify HEAD)
git push -f origin "${hash}:refs/heads/weekly-demos"
echo "::set-output name=commithash::$hash"
fi
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'Weekly Demos',
owner,
repo,
head: 'weekly-demos',
base: 'main',
body: [
'This PR is auto-generated by CI pipeline'
].join('\n')
});
if: steps.push-changes.outputs.commithash != ''

0 comments on commit c173fd2

Please sign in to comment.