From 2c2de060c015c60dc24002448e7b8d508d2fbef4 Mon Sep 17 00:00:00 2001 From: Bence Csizmadia Date: Sun, 30 Apr 2023 22:15:19 +0200 Subject: [PATCH] Initial commit --- .github/workflows/main.yml | 19 +++++++++++++++++++ README.md | 2 ++ bin/commit | 10 ++++++++++ bin/doit | 9 +++++++++ lib/doit.rb | 15 +++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 README.md create mode 100755 bin/commit create mode 100755 bin/doit create mode 100644 lib/doit.rb diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..88b7e300 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,19 @@ +name: Just Do It + +on: + push: + branches: [ "main" ] + schedule: + - cron: "*/30 * * * *" + +jobs: + just_do_it: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: 🔥 + run: bin/doit + + - name: 🤪 + run: bin/commit ${{ secrets.TOKEN }} ${{ github.repository_owner }} diff --git a/README.md b/README.md new file mode 100644 index 00000000..33858f9e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +## DO IT :wave: :wave: :wave: + \ No newline at end of file diff --git a/bin/commit b/bin/commit new file mode 100755 index 00000000..d20b9c8b --- /dev/null +++ b/bin/commit @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +TOKEN=$1 +OWNER=$2 + +git config user.name $OWNER +git config user.email $(curl -s -H "Authorization: Bearer $TOKEN" https://api.github.com/users/$OWNER | jq -r '.email') +git add . +git commit -m "just do it :see_no_evil: :sparkle:" +git push origin HEAD diff --git a/bin/doit b/bin/doit new file mode 100755 index 00000000..3269477b --- /dev/null +++ b/bin/doit @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +# frozen_string_literal: true + +require "fileutils" + +require_relative "../lib/doit" + +DOIT::doit diff --git a/lib/doit.rb b/lib/doit.rb new file mode 100644 index 00000000..675fb85c --- /dev/null +++ b/lib/doit.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module DOIT + @README = "./README.md" + + def self.doit + contents = File.read(@README) + if contents.length % 2 == 0 + File.write(@README, "#{contents} ") + else + contents.slice!(-1) + File.write(@README, contents) + end + end +end