- remove_red_eye194 Views
- event20 Oct 2018
- access_time3 min read
Github announced a new feature around a month ago called Action which would be workflow system inbuilt inside Github repository. We can look for an event such as push, pull etc and perform some predefined action such as send notification or execute another script.
Github sent me the beta access around a week ago and I am pumped to give it a try. In this article, I am going to give you a bit of an overview of how Github action work and a simple example for understanding.
To get an invite, submit your request here.
You need to have a private repository for action to work. Log in to your Github account and create a new private repository.
After creating your repository, click on the new tab called Actions.
Click on Create a new workflow button and click on an edit button. You can choose the various events but for the sake of simplicity, I am going to choose the Push event.
I am going to create a workflow which will send a message on a Slack group on every commit push.
To achieve that, you need to have a Slack app and an integration URL. Go to Slack developer page and register your new app.
Once you have an app created on Slack developer platform, go to Incoming Webhooks from the left menu bar and enable it.
Copy the Webhook URL from the page and keep it with you. Also, install the App in your Slack workspace.
Assuming you have done that, let’s create our workflow.
Drag the blue arrow to the box and search for the slack app. Refer the image below for the reference.
Click on the use button and it will ask you to fill in details.
On args textbox, push the message you want to see in the slack. Then create a new secret and put the key name as SLACK_WEBHOOK and value as the slack webhook URL.
Refer the image below for reference.
To save the workflow, click on the Commit button and your workflow will be saved.
Let’s test it out.
Push a commit on your repository and you should see a message from Github on your Slack channel.
Well, it worked!
This is beta so expect some crashes or failure.
This is really going to be the most useful tool for developers and DevOps people to perform automation with real ease. This will cut down infrastructure cost and help developers a lot. Great job Microsoft, can’t wait to see Github actions in production.