-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f44bf10
commit 133f300
Showing
1 changed file
with
27 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
name: Udemy Coupons Fetcher | ||
|
||
on: workflow_dispatch | ||
on: | ||
workflow_dispatch: | ||
# Add the following schedule to run the workflow every 24 hours | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
# For Debug into the runner image | ||
# - name: Start tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run Python script | ||
run: python ucf_ci.py | ||
working-directory: ${{ github.workspace }} | ||
|
||
- name: Run Python script | ||
run: python ucf_ci.py | ||
working-directory: ${{ github.workspace }} | ||
- name: Save coupons.txt as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coupons | ||
path: coupons.txt | ||
|
||
- name: Save coupons.txt as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coupons | ||
path: coupons.txt | ||
- name: Upload to Telegram | ||
run: | | ||
BOT_TOKEN="${{ secrets.TELEGRAM_BOT_TOKEN }}" | ||
CHAT_ID="${{ secrets.TELEGRAM_CHAT_ID }}" | ||
curl -F [email protected] "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument?chat_id=${CHAT_ID}" | ||
env: | ||
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} |