Tuesday, August 20, 2019

How To Use Blendo's Discord Changelog Bot With BitBucket!


So I read this:


(Which is by the guy who made Quadrilateral Cowboy and 30 Flights of Lovin' and other games. He's also a cool guy that I've met in Los Angeles! We've played board games together. He gave our team a bad clue that involved a computer mouse or something iirc and then he took it away, but we all insisted it meant something, but he wasn't allowed to talk to us, and so this led to our failing to put the murderer(s) to death or something. What does that say about 2019??)

The post I linked to above is about how to automate posting commit notes to one's Discord server. Brendon casually tosses in the fact that this could easily be integrated into other version control frameworks or whatever. Well, for me it was a great struggle. But here's what I ended up doing:

1. I downloaded Brendon's source code.

2. I read Brendon's readme.txt and obeyed the part about copy/pasting my Discord webhook URL into the settings.txt file.

3. (THIS IS WHERE I HAD TO START THINKING FOR MYSELF AND THIS IS WHAT I FOUND THAT WORKED:) In my repository for Flock of Dogs, I created a folder 'hooks':


4. If you have a file named 'commit-msg' inside a folder titled 'hooks' inside a folder titled '.git' inside your repository, then when you call 'git commit' either from the terminal or from SourceTree, git will try to execute that file. So I created a file named 'commit-msg' (yes, it is extensionless!):


5. In that extensionless, empty file, I wrote the following shell script that calls Brendon's changelogbot.exe. Since it's a shell script, it won't just run in Windows, but I guess however git does things, it has access to Linux stuff, so it works. At least for me. At least on my computer. Today. Here's its contents:

(From inspecting Brendon's source code, he expects at least 4 parameters. The 3rd is a string that is the file name of the file that has the commit message. The 4th is a string to append to the Discord message title after "REVISION"...the the first two arguments he didn't use, so I spoofed them with two '0's. Also, because he expected to use a file with the commit message, that's why I had to pipe the commit message into a new text document, 'commit_message.txt', which I  delete after I'm done with running the changelogbot.)


And voila. This took me several hours. I will talk about the wrong paths I went down in another post, because idk why, except whenever I find cut, little scripts on the internet that do magical things, I always assume the creator did it in like 5 minutes and, at the risk of betraying my own incompetence, I want the world to know my pain. And yes, I consider my 'commit-msg' a cute, little script.


No comments:

Post a Comment