<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Timothy Jhey Sarmiento</title>
    <description>The latest articles on DEV Community by Timothy Jhey Sarmiento (@jheytim).</description>
    <link>https://dev.to/jheytim</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4032616%2F3994b0d7-a38d-46a1-aa88-64a0730bbb49.jpg</url>
      <title>DEV Community: Timothy Jhey Sarmiento</title>
      <link>https://dev.to/jheytim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jheytim"/>
    <language>en</language>
    <item>
      <title>Commit Cron: A Simple Daily Commit Bot with GitHub Actions</title>
      <dc:creator>Timothy Jhey Sarmiento</dc:creator>
      <pubDate>Thu, 16 Jul 2026 18:30:48 +0000</pubDate>
      <link>https://dev.to/jheytim/commit-cron-a-simple-daily-commit-bot-with-github-actions-3i0b</link>
      <guid>https://dev.to/jheytim/commit-cron-a-simple-daily-commit-bot-with-github-actions-3i0b</guid>
      <description>&lt;p&gt;I built &lt;strong&gt;Commit Cron&lt;/strong&gt;, a small GitHub Actions experiment that creates one automated commit every day.&lt;/p&gt;

&lt;p&gt;The project updates a text file with the latest execution time, commits the change using the github-actions[bot] account, and pushes it back to the repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;View the project on GitHub: &lt;a href="https://github.com/JheyTim/commit-cron" rel="noopener noreferrer"&gt;Commit Cron&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works&lt;/strong&gt;&lt;br&gt;
The workflow runs every day at &lt;strong&gt;10:00 AM Asia/Manila time.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;10&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;
      &lt;span class="na"&gt;timezone&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Asia/Manila"&lt;/span&gt;

  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;workflow_dispatch&lt;/code&gt; trigger also lets me run the workflow manually from the GitHub Actions tab.&lt;/p&gt;

&lt;p&gt;The workflow checks out the repository, creates the &lt;code&gt;bot&lt;/code&gt; directory when needed, and updates &lt;code&gt;bot/last-run.txt&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; bot

&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s2"&gt;"Last automatic update: %s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;TZ&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Asia/Manila &lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="s1"&gt;'+%Y-%m-%d %H:%M:%S %:z (Asia/Manila)'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; bot/last-run.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file contains a timestamp similar to:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Last automatic update: 2026-07-17 10:03:24 +08:00 (Asia/Manila)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After updating the file, the workflow configures the GitHub Actions bot identity and creates the commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.name &lt;span class="s2"&gt;"github-actions[bot]"&lt;/span&gt;
git config user.email &lt;span class="se"&gt;\&lt;/span&gt;
 &lt;span class="s2"&gt;"41898282+github-actions[bot]@users.noreply.github.com"&lt;/span&gt;

git add bot/last-run.txt
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"chore: daily automated update"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before pushing, it pulls the latest branch changes with rebase:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull &lt;span class="nt"&gt;--rebase&lt;/span&gt; origin &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GITHUB_REF_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
git push origin &lt;span class="s2"&gt;"HEAD:&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GITHUB_REF_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps prevent the push from failing when another commit is added while the workflow is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository Structure&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── .github/
│   └── workflows/
│       └── daily-commit.yml
├── bot/
│   └── last-run.txt
├── LICENSE
└── README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why I Built It&lt;/strong&gt;&lt;br&gt;
Commit Cron is a small demonstration of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scheduled GitHub Actions workflows&lt;/li&gt;
&lt;li&gt;Manual workflow triggers&lt;/li&gt;
&lt;li&gt;Automated file updates&lt;/li&gt;
&lt;li&gt;Bot-generated Git commits&lt;/li&gt;
&lt;li&gt;Repository write permissions using &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The workflow uses:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows the built-in GitHub token to push the generated commit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Note&lt;/strong&gt;&lt;br&gt;
The automated commits only confirm that the workflow ran successfully.&lt;/p&gt;

&lt;p&gt;They do not represent manual development activity or meaningful project contributions.&lt;/p&gt;

&lt;p&gt;Scheduled workflows may also start later than the configured time during periods of high demand, which is why &lt;code&gt;bot/last-run.txt&lt;/code&gt; records the actual execution time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Commit Cron is a small project, but it is a useful introduction to scheduled GitHub Actions and automated repository updates.&lt;/p&gt;

</description>
      <category>github</category>
      <category>githubactions</category>
      <category>automation</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
