From 23cce7cb9b46d6ede3aa150769e733a82159fde3 Mon Sep 17 00:00:00 2001 From: gradedSystem Date: Tue, 15 Oct 2024 19:27:15 +0700 Subject: [PATCH 1/4] [add][m] Adding github actions --- .github/workflows/actions.yml | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..69a6361 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,63 @@ +# 59 23 * * * + +name: Update natural gas data + +on: + # Schedule to run on the 1st day of each month + schedule: + - cron: '59 23 * * *' + + # Run on push to master branch + push: + branches: + - main + + # Run on pull requests targeting the master branch + pull_request: + branches: + - main + + # Allows manual triggering of the workflow + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + if: github.ref == 'refs/heads/main' + + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install Python dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install -r scripts/requirements.txt + + - name: Run Make File + run: | + source venv/bin/activate + cd scripts + make + + - name: Push and Commit + env: + CI_COMMIT_NAME: "Automated commit" + CI_COMMIT_EMAIL: "actions@users.noreply.github.com" + CI_COMMIT_MESSAGE: "Automated commit" + run: | + git config --global user.email "${{env.CI_COMMIT_EMAIL}}" + git config --global user.name "${{env.CI_COMMIT_NAME}}" + git diff --quiet && echo "No changes to commit" || ( + git add . && + git commit -m "${{env.CI_COMMIT_MESSAGE}}" && + git push origin main + ) \ No newline at end of file From 63b795a3b843aef9c658bf84577318f393e1de58 Mon Sep 17 00:00:00 2001 From: gradedSystem Date: Mon, 21 Oct 2024 16:31:13 +0700 Subject: [PATCH 2/4] [fix][s] remove comment / fix cron job --- .github/workflows/actions.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 69a6361..328c332 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,23 +1,18 @@ -# 59 23 * * * - name: Update natural gas data on: - # Schedule to run on the 1st day of each month + # Schedule to run on daily basis at 00:00 UTC schedule: - - cron: '59 23 * * *' + - cron: '0 0 * * *' - # Run on push to master branch push: branches: - main - # Run on pull requests targeting the master branch pull_request: branches: - main - # Allows manual triggering of the workflow workflow_dispatch: jobs: From 79d9f365682490e6cac3378b28f5b4d1a2d45e54 Mon Sep 17 00:00:00 2001 From: Yedige Ashmet <55581804+gradedSystem@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:19:48 +0500 Subject: [PATCH 3/4] [fix][s] Adding only data --- .github/workflows/actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 328c332..87fe9f4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -52,7 +52,7 @@ jobs: git config --global user.email "${{env.CI_COMMIT_EMAIL}}" git config --global user.name "${{env.CI_COMMIT_NAME}}" git diff --quiet && echo "No changes to commit" || ( - git add . && + git add data && git commit -m "${{env.CI_COMMIT_MESSAGE}}" && git push origin main - ) \ No newline at end of file + ) From a2ef1730d06d20eb82d17dfcd600bb107bcffb14 Mon Sep 17 00:00:00 2001 From: Yedige Ashmet <55581804+gradedSystem@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:23:23 +0500 Subject: [PATCH 4/4] [fix][xs] Update actions.yml --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 87fe9f4..6cefa70 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -52,7 +52,7 @@ jobs: git config --global user.email "${{env.CI_COMMIT_EMAIL}}" git config --global user.name "${{env.CI_COMMIT_NAME}}" git diff --quiet && echo "No changes to commit" || ( - git add data && + git add data archive && git commit -m "${{env.CI_COMMIT_MESSAGE}}" && git push origin main )