Table of Contents
My Workflow
What inspired me?
I spend most of my free time with coding and I need fairy of inspiration during these times of intense thinking.
Focusing on the same issue for a long time can be very tiring sometimes. Especially if the target problem doesn't have a single solution.
Every time I feel burnout, I want to take my mind on different adventures. And often the easiest way to start such an adventure is with a 'Shuffle Play' button.
The same algorithm can be written differently by each developer. The developer's code style becomes their signature.
So the question in my mind was:
Coding is an art, so what do artists listen to while performing this art?
I thought it might be a pretty fun and elegant way to answer: creating a developers' collaborative playlist, all automated using GitHub Actions.
How I created the workflow?
If I could, I would like to automate everything in this life. I may never be able to automate dealing with people, but this project has been a good medicine for my automatization addiction.
First I had to overcome some problems before reaching my final goal:
- Communication with Spotify API, refreshing OAuth tokens, searching for songs and adding a track to the target playlist...
- Evaluating the issues opened by the users and returning an appropriate result. Answering and closing issues.
- To make things a little wackier, picking random gifs from various categories and using them.
- The name of the developer who opened the issue and their favorite song should be stored as a contributor and written in the README.
- Errors, errors and errors.
Solution workflow for problem 1: dealing with Spotify API
Let's be honest, Spotify has pretty good API documentation. But things can get complicated as you get involved.
I didn't want to have a lot of code in this repository I created for GitHub Actions Hackathon and make the situation even more complicated. For this reason, I created a different public repository and kept all the tools I wrote to communicate with the Spotify API in there. Thus, I would be able to effectively use GitHub actions' ability to communicate with a different repository.
My two different repository will communicate like:
The constantly talking kid on the left would represent the repository where I used GitHub Actions and submitted for this Hackathon, while the kid on the right that would just listen and execute the commands would represent the repository where I kept my auxiliary Spotify API functions.
In this scenario, the string itself would of course be GitHub Actions.
Solution workflow for problem 2: issues, issues...
In order for the developers to make a song request, they should open an issue with the title 'song request' and the body of the issue should have a text in - format.
Thus, it was necessary to correctly evaluate the issues opened by the users and to produce the necessary actions accordingly.
In this process, I explored the unlimited features of GitHub Actions and had to use many features from if-checks to environment variables.
Solution workflow for problem 3: random wacky gifs
Generating random gifs was very useful in two ways:
- Responses to issues opened by developers would be more fun and varied.
- There couldn't have been a better opportunity for me to learn about environment variables and cross-jobs data sharing.
Therefore I did it. do i regret it? No. Was that wacky? Maybe.
Solution workflow for problem 4: contributors
It was a good idea to view the songs added by each user. Until you try to code it.
GitHub Actions does not keep any persistent data by nature. So I had to overcome this nature and keep contributors' information:
I created files for every single contributor. Each time a new song was added, these files and the README_template would be concatenated and a new README file would be created. At this point, I used the code push feature to the target repository, which is readily available in the GitHub Actions marketplace.
Solution workflow for problem 5: error handling
If the input of the developed tool is controlled by the users, errors are inevitable.
In this scenario, developers are expected to adhere to certain formats when requesting songs. For this reason, all wrong entries need to be handled properly.
For example, in case of a wrong issue title or when the searched song is not found, an appropriate answer should be returned and the developer should be informed.
I will continue to improve this part after the contest ends. For example, now the same song can be added to the playlist multiple times. While I initially thought this was logical because popular songs were included more, I think it should be fixed in the future. I'm also considering making a custom super cool website reserved for my lovely contributors ๐คฉ
I can say that most of the time of the project I developed was spent managing the inputs. I think user experience is very important at this point. Also a big kudos to everyone who has added their favorite songs on the GitHub repository and gave a feedback to me, thus contributing to an open source project!
Frankly, without GitHub Actions, this project would not have been easy to realize and popularize among developers.
In this process, I also had the opportunity to explore and use many ready-made works in the GitHub Actions market:
- actions/checkout@v2 ๐
- actions/download-artifact@v1 ๐
- actions/github-script@v5 ๐
- peter-evans/close-issue@v1 ๐
- actions/upload-artifact@v1 ๐
- actions/setup-python@v2 ๐
- ad-m/github-push-action@master ๐
Submission Category:
Wacky Wildcards
Yaml File or Link to Code
Here is the repository:
oz9un / Developers-Playlist
A drop of musical taste from every contributor... Welcome to the developer's collaborative playlist.
Developers' Playlist \(๐_๐ฟ)/
A drop of musical taste from every contributor... Welcome to the developers' collaborative playlist.
Playlist link: Developers' Collaborative Playlist
Description๐ค:
The same algorithm can be written differently by each developer. The developer's code style becomes their signature.
Coding is an art, so what do artists listen to while performing this art?
The Developer's Playlist analyzes opened issues on this repository using GitHub Actions and collects developers' favorite songs into a collaborative playlist.
Usage๐:
- Open an issue with title 'song request' (โ 'Song request' and 'Song Request' also works right now.โ )
- Write your favorite track to issue's body in format: "artist-song". (โ If there is a dash "-" in the artist or song title, please use space instead for now. โ )
- Wait for the Github Action Bot's response
- Enjoy the developers' collaborative playlist!
- You can also keep track of who added which songs by checking out theโฆ
You can also view the YAML file: devs_playlist_action.yaml
Additional Resources / Info
Developers:
1- oz9un
2- 1
3- 2
About the cover image:
Cover image is created with AI. Only using the text: "Developers Playlist"
It's the song request time!
Let's open an issue with your favorite song and enjoy the Developers' Favorite Playlist!
Top comments (0)