DEV Community

Cover image for GitHub + DEV 2023 Hackathon! - Github Commit Message Translator πŸ“–
Dmytro Werner
Dmytro Werner

Posted on

GitHub + DEV 2023 Hackathon! - Github Commit Message Translator πŸ“–

What I built

I built GitHub action, that automatically translate commit message and pushes the message into GitHub pages using Jekyll for creating documentation or changelog.

Read

Category Submission:

Maintainer Must-Haves

App Link

GithubPage

Screenshots

Image description

Image description

Image description

Description

After each commit, the message, that was written will be translated using Translator-API from mymemory.net. In .yml file, you can define target and source languages. After message was translated, the message will be sent to gh-pages, that is used as "documentation branch". I used Jekyll to create static webpage, that used markdown files for building pages. En voilΓ , at the end we have translated messages as documentation.

Link to Source Code

Github translated commits into gh-pages for documentation/changelog πŸ“–

The project was created to generate translation for commit messages for supporting open source maintainers and repository owners to make it easier to write commit messages in other languages.

Key Technologies

  • GitHub Pages
  • GitHub Action
  • MyMemory API (for translation)
  • Jekyll

There are two option for languages (source and target language), other information will be got automatically from workflow. The .yml file look like:Β 

name: Translate commit message
on: [push]
jobs
  run-script:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install Node.js
        uses: actions/setup-node@v2
        with:
          node-version: "18.x"
      - name: Install dependencies
        run: npm install
      - name: Get Commit Message
        id: commit_message
        run: echo "::set-output name=message::$(cat $GITHUB_EVENT_PATH | jq -r '.commits[0].message')"
      - name: Run Script
        run: node action/index.js
        env:
          
…
Enter fullscreen mode Exit fullscreen mode

Permissive License

MIT

Background (What made you decide to build this particular app? What inspired you?)

I was thinking, the main idea of open source is to connect people from all around the corner, to build some cool projects. But there are so many languages, so it's sometimes difficult, to describe, what did you do in your commit. In other side this is also important for repository-owner, to get important information about workflow. In the best case as documentation.

How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)

I did learn a lot about GitHub Actions and GitHub Pages. For me, it was fascinating to create workflow, that automatically create new content for me. Functionality of "gh-pages" was for also something new to know, especially how does it work with Jekyll integration. I used all this information and of course the functionality of GitHub Actions to build it all in one tool. The information about workflow is also available in README file in my repository.

Additional Resources/Info

GithubPages
GithubJekyll

Top comments (0)