diff options
Diffstat (limited to '_posts/notes/2023-05-27-cronjobs-github-with-actions.md')
| -rw-r--r-- | _posts/notes/2023-05-27-cronjobs-github-with-actions.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/_posts/notes/2023-05-27-cronjobs-github-with-actions.md b/_posts/notes/2023-05-27-cronjobs-github-with-actions.md new file mode 100644 index 0000000..3fd2fdc --- /dev/null +++ b/_posts/notes/2023-05-27-cronjobs-github-with-actions.md | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | --- | ||
| 2 | title: "Cronjobs on Github with Github Actions" | ||
| 3 | permalink: /cronjobs-github-with-actions.html | ||
| 4 | date: 2023-05-27T00:35:36+02:00 | ||
| 5 | layout: post | ||
| 6 | type: note | ||
| 7 | draft: false | ||
| 8 | tags: [github] | ||
| 9 | --- | ||
| 10 | |||
| 11 | In the root of your repository create a folder `.github/workflows` and in that | ||
| 12 | folder create a file a file `cron.yaml`. This file can be named whatever you | ||
| 13 | wish. But it has to be a `yaml` file. | ||
| 14 | |||
| 15 | File below (`.github/workflows/cron.yaml`) describes an action that will trigger | ||
| 16 | every six hours and it will curl example.com. | ||
| 17 | |||
| 18 | However. Be sure that you have enough credits. Free account is not that generous | ||
| 19 | with the minutes they give you for free. Check more about GitHub Actions usage | ||
| 20 | on their website https://docs.github.com/en/actions. | ||
| 21 | |||
| 22 | ```yaml | ||
| 23 | # .github/workflows/cron.yaml | ||
| 24 | name: Do a curl every 6 hours | ||
| 25 | on: | ||
| 26 | schedule: | ||
| 27 | - cron: '0 */6 * * *' | ||
| 28 | jobs: | ||
| 29 | cron: | ||
| 30 | runs-on: ubuntu-latest | ||
| 31 | steps: | ||
| 32 | - name: Call some url | ||
| 33 | run: curl 'https://example.com' | ||
| 34 | ``` | ||
