DEV Community

Cover image for Lord of the Pythons!!
Matt Hamilton
Matt Hamilton

Posted on

1

Lord of the Pythons!!

My Workflow

So, you like Lord of the Rings, right? Every developer likes LotR, right? Don't you wish that more of your code had variables named after LotR characters? Right? RIGHT?!

What about if you could actually get PAID for replacing the variable names in your code with LotR names? Wouldn't that be AWESOME?!

Party hard Gandalf!

The wait is over... the ULTIMATE Github Action is here.

When you push code to a Github repo this action goes through all .py files it can find, parses them with an AST and pulls out the variable names. It then cross references them against LotR characters... and if you have increased the number of variables named after LotR characters in this set of commits then you are immediately paid an amount of XRP for your devotion and love.

Submission Category:

Wacky Wildcards Of course!

Yaml File or Link to Code

This is how you get all the goodness... ohhhh yeah baby!

name: Lord of the Pythons

on:
  # Trigger the workflow on push or pull request,
  # but only for the master branch
  push:
    branches:
      - master

jobs:
  pay:
    runs-on: ubuntu-latest
    steps:

    - name: Checkout code  
      uses: actions/checkout@v2
      with:
        fetch-depth: 5

    - name: Checkout prior code  
      uses: actions/checkout@v2
      with:
        ref: ${{ github.event.before }}
        path: .old-code

    - name: Checkout current code  
      uses: actions/checkout@v2
      with:
        path: .new-code

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: get commit message
      run: |
        echo ::set-env name=commit_log::$(git log --format=%B ${{ github.event.before }}..${{ github.event.after }})
    - name: Get number of new LotR characters
      id: lotr
      uses: hammertoe/lord_of_the_pythons@master

    - name: Run PayID
      uses: hammertoe/payid_xrp_action@1.1
      if: ${{ steps.lotr.outputs.num > 0 }}
      with:
        wallet_secret: ${{ secrets.PAYID_WALLET_SECRET }}
        amount: ${{ steps.lotr.outputs.amount }}
        commit_log: ${{ env.commit_log }}
Enter fullscreen mode Exit fullscreen mode

The full link to the repo is here:

GitHub logo hammertoe / lord_of_the_pythons

A Github Action that analyses Python code and detects new variables named after LotR characters and pays developers as a reward

Lord of the Pythons

Party hard!

What?

A Github Action that analyses Python code and detects new variables named after LotR characters and a workflow that pays developers as a reward.

When you push code to a Github repo it goes through all .py files it can find, parses them with an AST and pulls out the variable names. It then cross references them against LotR characters... and if you have increased the number of variables named after LotR characters in this set of commits then you are immediately paid an amount of XRP for your devotion and love.

This action was created for the DEV: Github Actions hackathon.

As you might image, it is for the "Wacky" category.

It utilises the Automatically pay Contributors in XRP via PayId that was also developer by myself for this same hackathon.

Why?!

Developers love fantasy like Lord of The Rings, right? Developers like…

Additional Resources / Info

This action utilises another action that I have developed for this hackathon, payid_xrp_action which has it's own entry.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay