ASH writers who use GitHub, what does your workflow/setup look like?

I want to host and develop my ASH scripts on GitHub. I noticed that several people already do this. If we share how each of us manage our projects, we could collect helpful topics for GitHub users. (Git and GitHub are incredibly popular among developers, so something like this could help more people write ASH scripts.) So please share what your project looks like, or comment on them!

(My own setup has been split to post #2 for better organization)
 
Last edited:
Here's what I discovered so far:

GitHub provides a bridge for Subversion clients. KoLmafia can checkout a GitHub project as though it was a Subversion repo:

Code:
svn checkout https://github.com/<your_id>/<project_slug>

Your project can and will often contain useful files not related to KoLmafia itself. This includes README.md, LICENSE, and .gitignore. However, KoLmafia will refuse to check out a repository containing any files it doesn't know. I observed two workarounds for this.

Solution 1: Put your ASH scripts under a subdirectory in your main branch. This subdirectory is usually named build or release (see autoscend for example):

Code:
build/
  scripts/
    my-script.ash
  relay/
    some-relay-script.ash
.gitignore
LICENSE
README.md

Then tell KoLmafia to checkout this subdirectory:

Code:
svn checkout https://github.com/<your_id>/<project_slug>/trunk/<subdirectory>

This setup is simpler than the method 2. However, it will cause all commits to your main branch to propagate to your users. Commit with caution!

Solution 2: Maintain a separate Git branch which contains only files that KoLmafia accepts. This branch is often named release (see TourGuide for example). You can tell KoLmafia to checkout from this branch like this:

Code:
svn checkout https://github.com/<your_id>/<project_slug>/branches/release

Your can continue development on another branch (usually master or main), and merge your changes to the release branch when you're ready to share them.

This method is trickier than method 1, since you have to juggle with an extra branch. However, if you have a custom build process (like autoscend or TourGuide), the second option may help you stick to the Single Source of Truth principle (i.e. not storing your build artifacts in the repo).

Personally? I'm sticking with method 1. I haven't found a good reason for me to use method 2 yet.
 

gausie

Develpoer
I really like 1, and use it with Excavator such that the server-side Python scripts that process the data are in the same repository but are not downloaded to end-user's machines.

The single source of truth principle is exactly why I would go with method 2 if my script ever included a build process. Not only do I want a single definition of my code, I also don't want to clutter my commit history with build output, and anyone checking out the code does not need to also fetch the build artifacts (unless they want to).
 
I really like 1, and use it with Excavator such that the server-side Python scripts that process the data are in the same repository but are not downloaded to end-user's machines.

The single source of truth principle is exactly why I would go with method 2 if my script ever included a build process. Not only do I want a single definition of my code, I also don't want to clutter my commit history with build output, and anyone checking out the code does not need to also fetch the build artifacts (unless they want to).

I like your GitHub Actions setup. Starred immediately. I also didn't know KoLmafia had a "headless" mode --CLI flag. Might be useful for automating tests.

By the way, my local repo is separate from my KoLmafia directory. My current workflow is <commit> → <push to GitHub> → <svn update in KoLmafia> to test and iterate changes. This feels rather cumbersome. Is there a better option? What does your workflow look like?
 
Last edited:

fredg1

Member
By the way, my local repo is separate from my KoLmafia directory. My current workflow is <commit> → <push to GitHub> → <svn update in KoLmafia> to test and iterate changes. This feels rather cumbersome. Is there a better option? What does your workflow look like?
Phil, remember that discussion I had in #mafia-and-ash about symlinks? The one you took part in? :)

 
Phil, remember that discussion I had in #mafia-and-ash about symlinks? The one you took part in? :)


I think you're looking for the wrong person, I am not "Phill Me (#2393910)" in that server. In fact I only joined a few days ago and don't remember taking part in any discussion yet.

Incidentally, I did try symlinking my script but it didn't work for some reason, perhaps b/c I tried to make the symlink within Git Bash. I made a hard link instead and it worked fine. It was a Win10 permissions issue. I ran cmd.exe as admin mode and mklink created a proper symlink.
 
Last edited:
Top