-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Svensson
committed
May 9, 2022
1 parent
9985bbc
commit c173fd2
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 != '' |