Adding Tools To Your GitHub Repositories
Tags: beginners, opensource, github, tutorial
Published: 2023-09-10 15:57:05

## Contents
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Accessing The Marketplace](#accessing-the-marketplace)
- [A Brief Overview](#a-brief-overview)
- [Integrating An App](#integrating-an-app)
- [Integrating An Action](#integrating-an-action)
- [Conclusion](#conclusion)
- [Share Support](#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][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][github] 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][github] while logged in, and select the hamburger menu in top left corner:
![GitHub Hamburger Menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wcu2nr02at0radhbhud.png)

A sidebar will appear.
Just at the bottom of it, you'll see a marketplace entry:
![GitHub Marketplace Button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ao0cxdq4aclielszrjkz.png)

Clicking it, you will reach [GitHub Marketplace][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.
![Explore GitHub Marketplace](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6h00po85cz1d8sfhrajg.png)

## 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:
![Imgbot Marketplace](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36gm30jam1d2jlb8s1o4.png)

Now just scroll down, select Open Source and click onto install:
![Install Bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sl6t9zt931nxk9xjv245.png)

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:
![GitHub Select Bot Repositories](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z58c0p7pa8vl6k99fex4.png)

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:
![Authorize Bot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o34w42jn7fu2kce01mdl.png)
> 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...
![Imgbot Winning Screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26tbj4etkmcrh52edtgk.png)

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:
![Installing GitHub Action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/on4t7mhttppce6xt9f8m.png)

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:
![Creating New File](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfeam4c1wzown2sk4mkf.png)

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:
![Create New Filename Explorer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crbtkna8tnijn7aw8vkr.png)

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:
![First Interaction Usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hkrbukpl8f9a0nnf714r.png)

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:
```yml
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:
![Action Test Issue](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcao1busvn3nbpcru3kq.png)

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][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][github-airscript].

[airscript-it]: https://airscript.it
[github-airscript]: https://github.com/airscripts
[github-marketplace]: https://github.com/marketplace
[github]: https://github.com