Adding Tools To Your GitHub Repositories
Francesco Sardone
Posted on September 10, 2023
Contents
- Introduction
- Requirements
- Accessing The Marketplace
- A Brief Overview
- Integrating An App
- Integrating An Action
- Conclusion
- Share Support
Introduction
Hey there! I'm Francesco known as Airscript on the web.
Today I want to share with you what is GitHub Marketplace and how you can use it for adding mainly tools to your repositories!
Requirements
In order to use GitHub Marketplace you'll need a personal GitHub account and preferably a repository where you can experiment all of this.
Accessing The Marketplace
In order to access the marketplace, go to your GitHub Dashboard while logged in, and select the hamburger menu in top left corner:
A sidebar will appear.
Just at the bottom of it, you'll see a marketplace entry:
Clicking it, you will reach GitHub Marketplace, where our adventure will take place.
A Brief Overview
Inside the marketplace we can practically select two different types of things: apps and actions.
They can be seen as almost the same thing: they just automate something and report back to you.
One of the key differences is that apps can act on their behalf.
Other than this, you can filter apps and actions by categories or their price.
No worries on that, most of the apps are regularly free for open source projects.
Integrating An App
After our brief introduction, I think it's time to start integrating stuff.
I've already selected one app, but feel free to experiment with your own needs and taste on that.
We'll try to integrate an image bot inside my blog repository:
Now just scroll down, select Open Source and click onto install:
The platform will ask you for a payment method but don't worry, the bot is free of cost, it's just a requirement.
Follow the steps and eventually you'll see something like this:
I've just selected one repository, but you can install over them all or wherever you want to.
Now that everything is setup, just click onto install again.
You'll be prompted for a password and then a screen like this will show up for giving the actual permissions:
Just remember: you're giving permissions on acting on your behalf to the apps that you're integrating.
Be sure of what you're installing or it can lead to serious security flaws.
Here we can click the authorization button and...
Now it's just a matter of time for receiving a pull request from our bot that is optimizing repo's images in a lossless fashion!
Integrating An Action
The other type of cool things that we can take from the marketplace are the actions.
Actions are simple workflows that automate something.
Instead of reinventing the wheel writing your own commands for running automated tests, for example, you can just check if there is an action already prepared for this reason and install it right away on your fabulous project.
Now, into the action. Same thing as before, let's go to the marketplace and select an action filtering by type.
For this post, I've selected a simple Action called First Interaction.
It simply greets a user on the first issue or pull request:
Click onto use latest version and copy the lines of code that it just gives you.
Go onto your repository on GitHub and create a .yml file inside a .github folder like this:
After that, just write on top of the explorer this string: .github/workflows/interaction.yml
.
This is needed in order to create or point up to a folder.
The explorer I'm talking about it's something like this one:
And then, you can paste what we have actually copied.
Now, this is not enough because we're not telling the action the actual messages we want to display or, for example, on what kind of issues or pull requests it has to print them out.
Documentation comes in our help and every action has a usage section on their installation page:
So we'll just use the one from the example but a little bit more customization since it's missing all the environment's directives:
name: interaction
on:
issues:
types: [opened]
pull_request:
branches: [main]
types: [opened]
jobs:
interaction-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/first-interaction@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |
Hey there! Thank you kindly for filing an issue.
I'll reply back to you as soon as I can.
pr-message: |
Hey there! Thank you kindly for your contribution!
I'll review back as soon as I can.
What I'm telling here is simply that I want to run this action only on opened issues and pull requests that are being made towards main branch.
The next thing I configured is the actual job that indicates the machine it'll be running on and the custom messages for both issues and pull requests.
Simple, isn't it?
Now we can simply commit everything and wait for someone to contribute to our project to see the magic!
In my case I've just asked @ilmanzo to open a test issue for me:
And this clears up the process on integrating also an action!
Conclusion
Today we have seen what is GitHub Marketplace and how to use it to integrate Apps and Actions as tools onto our repositories.
It may be challenging at first but don't give up!
Struggle is a sign of growth if you move toward it.
Share Support
If you have liked this post, just come and tell me!
Are you too shy for doing this? No problem. Just visit airscript.it and share your support following me on your preferred social platform.
If you want to make me even happier, just follow, share or star me and my projects on GitHub.
Posted on September 10, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.