diff --git a/.github/workflows/process_challenge.yml b/.github/workflows/process_challenge.yml index f3964c81c..2fada90da 100644 --- a/.github/workflows/process_challenge.yml +++ b/.github/workflows/process_challenge.yml @@ -3,11 +3,9 @@ name: evalai-challenge on: - push: - branches: [challenge] + push: {} pull_request: types: [opened, synchronize, reopened, edited] - branches: [challenge] jobs: build: runs-on: ubuntu-20.04 @@ -23,14 +21,14 @@ jobs: if [ -f github/requirements.txt ]; then pip install -r github/requirements.txt; fi - name: Validate challenge run: | - python3 github/challenge_processing_script.py + python3 github/challenge_processing_script.py ${GITHUB_REF#refs/heads/} env: IS_VALIDATION: 'True' GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }} - name: Create or update challenge run: | - python3 github/challenge_processing_script.py + python3 github/challenge_processing_script.py ${GITHUB_REF#refs/heads/} if: ${{github.event_name == 'push' && success()}} env: IS_VALIDATION: 'False' diff --git a/github/challenge_processing_script.py b/github/challenge_processing_script.py index b0c88bb98..19022f121 100644 --- a/github/challenge_processing_script.py +++ b/github/challenge_processing_script.py @@ -62,7 +62,12 @@ zip_file = open(CHALLENGE_ZIP_FILE_PATH, "rb") file = {"zip_configuration": zip_file} - data = {"GITHUB_REPOSITORY": GITHUB_REPOSITORY} + github_branch = sys.argv[1] if len(sys.argv) > 1 else "challenge" + + data = { + "GITHUB_REPOSITORY": GITHUB_REPOSITORY, + "GITHUB_BRANCH": github_branch, + } try: response = requests.post(url, data=data, headers=headers, files=file)