diff options
Diffstat (limited to 'content')
| -rw-r--r-- | content/notes/cronjobs-github-with-actions.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/content/notes/cronjobs-github-with-actions.md b/content/notes/cronjobs-github-with-actions.md new file mode 100644 index 0000000..08dea54 --- /dev/null +++ b/content/notes/cronjobs-github-with-actions.md | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | --- | ||
| 2 | title: "Cronjobs on Github with Github Actions" | ||
| 3 | url: cronjobs-github-with-actions.html | ||
| 4 | date: 2023-05-27T00:35:36+02:00 | ||
| 5 | type: notes | ||
| 6 | draft: false | ||
| 7 | tags: [github, actions] | ||
| 8 | --- | ||
| 9 | |||
| 10 | In the root of your repository create a folder `.github/workflows` and | ||
| 11 | in that folder create a file a file `cron.yaml`. This file can be named | ||
| 12 | whatever you wish. But it has to be a `yaml` file. | ||
| 13 | |||
| 14 | File below (`.github/workflows/cron.yaml`) describes an action that will | ||
| 15 | trigger every six hours and it will curl example.com. | ||
| 16 | |||
| 17 | However. Be sure that you have enough credits. Free account is not that | ||
| 18 | generous with the minutes they give you for free. Check more about | ||
| 19 | GitHub Actions usage on their website https://docs.github.com/en/actions. | ||
| 20 | |||
| 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 | ``` | ||
