DEV Community

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

Posted on

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.

Top comments (0)