Jekyll
Jekyll builds files. GitHub Pages will not run a mail plugin. The form has to post to a form backend.
<form action="https://smote.sh/f/FORM_ID" method="POST"> <input name="email" type="email" required> <textarea name="message" required></textarea> <input type="hidden" name="_redirect" value="https://yoursite.com/thanks"> <button>Send</button> </form>
Save the form as _includes/contact.html. In a page: {% include contact.html %}. That is allowed on GitHub Pages. A Ruby mailer gem is not.
If the site already lives at *.github.io, this is the whole setup. Guide for the host: GitHub Pages contact form.
Also: GitHub Pages · Hugo · Astro · Cloudflare Pages · Any static site