Skip to content

run data fetching job #7306

run data fetching job

run data fetching job #7306

Workflow file for this run

name: run data fetching job
env:
PR_NUMBER: PR-${{ github.event.number }}
DATA_DIR: data
GITHUB_URL: https://mariloubylr:${{ secrets.GITHUB_TOKEN }}@github.com/mariloubylr/ci-magic.git
on:
workflow_run:
workflows: ["build-frontend-main", "build-frontend-pr-pages"]
types:
- completed
schedule:
- cron: '*/6 * * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@main # checkout the repository content
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10' # install python
- run: |
cd backend
ls
shell: bash
- name: install python packages
run: |
python -m pip install --upgrade pip
- name: execute python script # run main.py
run: |
python backend/fetch_data.py ${{env.DATA_DIR}}
ls
- name: Clone gh-pages repo
run: |
mkdir -p temp_build
cd temp_build
git init -q --initial-branch='gh-pages'
git remote add origin ${{env.GITHUB_URL}}
git config --global user.email "[email protected]"
git config --global user.name "mariloubylr"
git config --local advice.skippedCherryPicks false # Disable messages to include skipped commits
git pull -q origin gh-pages --rebase -X theirs > /dev/null
ls
- name: Sets env vars for prod
if: github.ref == 'refs/heads/main'
run: |
echo "DATA_TARGET=prod/data" >> $GITHUB_ENV
- name: Sets env vars for PRs
if: github.ref != 'refs/heads/main'
run: |
echo "DATA_TARGET=PR-${{ github.event.number }}/data" >> $GITHUB_ENV
- name: Copy data into repo
run: |
echo $DATA_TARGET
mkdir -p temp_build/$DATA_TARGET
cp ${{env.DATA_DIR}}/* temp_build/$DATA_TARGET/
shell: bash
- name: Commit Data
run: |
cd temp_build
git add -A
git status
git commit -qm "update data to $DATA_TARGET"
- name: Push Data
if: ${{ git diff-index --quiet origin/gh-pages }}

Check failure on line 74 in .github/workflows/fetch_data.yml

View workflow run for this annotation

GitHub Actions / run data fetching job

Invalid workflow file

The workflow is not valid. .github/workflows/fetch_data.yml (Line: 74, Col: 13): Unrecognized named-value: 'git'. Located at position 1 within expression: git diff-index --quiet origin/gh-pages
run: |
git push -qf origin gh-pages:gh-pages
shell: bash