mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #336 from kiwix/better-ci-event
Run Github actions on any push (not only in PR)
This commit is contained in:
commit
083c06d170
|
@ -1,6 +1,6 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on: [pull_request]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Macos:
|
Macos:
|
||||||
|
@ -85,25 +85,20 @@ jobs:
|
||||||
container:
|
container:
|
||||||
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-26"
|
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-26"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Extract branch name
|
||||||
|
shell: bash
|
||||||
|
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
||||||
|
id: extract_branch
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
shell: python
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
import json
|
|
||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
from os import environ
|
from os import environ
|
||||||
with open(environ['GITHUB_EVENT_PATH'], 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
event_data = json.loads(content)
|
|
||||||
try:
|
|
||||||
branch_ref = event_data['ref'].split('/')[-1]
|
|
||||||
except KeyError:
|
|
||||||
branch_ref = event_data['pull_request']['head']['ref']
|
|
||||||
print("Cloning branch", branch_ref)
|
|
||||||
command = [
|
command = [
|
||||||
'git', 'clone',
|
'git', 'clone',
|
||||||
'https://github.com/${{github.repository}}',
|
'https://github.com/${{github.repository}}',
|
||||||
'--depth=1',
|
'--depth=1',
|
||||||
'--branch', branch_ref
|
'--branch', '${{steps.extract_branch.outputs.branch}}'
|
||||||
]
|
]
|
||||||
check_call(command, cwd=environ['HOME'])
|
check_call(command, cwd=environ['HOME'])
|
||||||
- name: Install deps
|
- name: Install deps
|
Loading…
Reference in New Issue