OP Stack Chain Revenue Pulls #11468
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
name: OP Stack Chain Revenue Pulls | |
on: | |
schedule: | |
- cron: '57 * * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Display System Info | |
run: | | |
free -h | |
df -h | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10.11' | |
- name: Cache pipenv dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.local/share/virtualenvs | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pipenv- | |
- name: Install pipenv | |
run: | | |
python -m pip install pipenv | |
- name: Install Dependencies | |
run: | | |
pipenv install --dev | |
- name: Generate py files | |
working-directory: op_chains_tracking | |
run: | | |
pipenv run jupyter nbconvert --to python l2_revenue_tracking.ipynb | |
- name: Run File | |
working-directory: op_chains_tracking | |
run: | | |
pipenv run python l2_revenue_tracking.py | |
env: | |
IS_RUNNING_LOCAL: ${{ secrets.IS_RUNNING_LOCAL }} | |
BQ_APPLICATION_CREDENTIALS: ${{ secrets.BQ_APPLICATION_CREDENTIALS }} | |
BQ_PROJECT_ID: ${{ secrets.BQ_PROJECT_ID }} | |
- name: Pull changes | |
run: | | |
git pull origin main | |
- name: Commit files | |
id: commit | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-actions" | |
git add --all | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "No changes to commit." | |
echo "push=false" >> $GITHUB_OUTPUT | |
else | |
git commit -m "GH Action Update - Chain Revenue" -a | |
echo "push=true" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Push changes | |
if: steps.commit.outputs.push == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |