This repository demonstrates how to set up a cron job using GitHub Actions. The job runs every 2 minutes and can also be triggered manually.
The cron job is defined in .github/workflows/cron.yml
.
- Scheduled: Runs every 2 minutes using the cron pattern:
*/2 * * * *
. - Manual: Can be triggered manually via GitHub using
workflow_dispatch
.
- Checkout: Clones the repository using
actions/checkout@v2
. - Data Synchronization: Sends a
POST
request to an API using secret values.
Add the following secrets to the repository:
CRON_API_TOKEN
CRON_API_URL
CRON_API_PATH
- Go to the Actions tab.
- Select the Run Cron Job workflow.
- Click Run workflow.