Add exampleSite and footer updates

This commit is contained in:
athul 2020-04-11 01:11:05 +05:30
parent 58d02550f1
commit dd1c9af419
21 changed files with 782 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

12
exampleSite/config.toml Normal file
View file

@ -0,0 +1,12 @@
baseURL = "http://example.org/"
languageCode = "en-us"
title = "Archie"
theme="archie"
[params]
subtitle = "Minimal and Crisp blog theme for hugo [blog theme for Hugo](https://github.com/vividvilla/ezhil)"
[[params.social]]
name = "Github"
icon = "github"
url = "https://github.com/vividvilla/ezhil"

View file

@ -0,0 +1,4 @@
+++
author = "Hugo Authors"
+++

View file

@ -0,0 +1,28 @@
+++
title = "About"
description = "Hugo, the worlds fastest framework for building websites"
date = "2019-02-28"
aliases = ["about-us","about-hugo","contact"]
author = "Hugo Authors"
+++
Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows.
Hugo makes use of a variety of open source projects including:
* https://github.com/yuin/goldmark
* https://github.com/alecthomas/chroma
* https://github.com/muesli/smartcrop
* https://github.com/spf13/cobra
* https://github.com/spf13/viper
Hugo is ideal for blogs, corporate websites, creative portfolios, online magazines, single page applications or even a website with thousands of pages.
Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases.
Websites built with Hugo are extremelly fast, secure and can be deployed anywhere including, AWS, GitHub Pages, Heroku, Netlify and any other hosting provider.
Learn more and contribute on [GitHub](https://github.com/gohugoio).

View file

@ -0,0 +1,5 @@
---
date: 2019-05-28
type: section
layout: "archives"
---

View file

@ -0,0 +1,7 @@
---
title: 'Our Difference'
button: 'About us'
weight: 2
---
Lorem ipsum dolor sit amet, et essent mediocritatem quo, choro volumus oporteat an mei. ipsum dolor sit amet, et essent mediocritatem quo,

View file

@ -0,0 +1,3 @@
---
headless : true
---

View file

@ -0,0 +1,7 @@
---
title: 'We Help Business Grow'
button: 'Our Work'
weight: 1
---
Lorem ipsum dolor sit amet, et essent mediocritatem quo, choro volumus oporteat an mei. Numquam dolores mel eu, mea docendi omittantur et, mea ea duis erat. Elit melius cu ius. Per ex novum tantas putant, ei his nullam aliquam apeirian. Aeterno quaestio constituto sea an, no eum intellegat assueverit.

View file

@ -0,0 +1,62 @@
---
title: "Primer: When You Have Too Much to Do"
date: 2020-04-01T02:01:58+05:30
description: "You have a to-do list that scrolls on for days. You are managing multiple projects, getting lots of email and messages on different messaging systems, managing finances and personal health habits and so much more."
tags: [Primer, todo]
---
You have a to-do list that scrolls on for days. You are managing multiple projects, getting lots of email and messages on different messaging systems, managing finances and personal health habits and so much more.
It all keeps piling up, and it can feel overwhelming.
How do you keep up with it all? How do you find focus and peace and get stuff accomplished when you have too much on your plate?
In this primer, Ill look at some key strategies and tactics for taking on an overloaded life with an open heart, lots of energy, and a smile on your face.
## The First Step: Triage
Whether youre just starting your day, or youre in the middle of the chaos and just need to find some sanity … the first step is to get into triage mode.
Triage, as you probably know, is sorting through the chaos to prioritize: what needs to be done now, what needs to be done today, what needs to be done this week, and what can wait? Youre looking at urgency, but also whats meaningful and important.
Heres what you might do:
* Pick out the things that need to be done today. Start a Short List for things youre going to do today. That might be important tasks for big projects, urgent tasks that could result in damage if you dont act, smaller admin tasks that you really should take care of today, and responding to important messages. I would recommend being ruthless and cutting out as much as you can, having just 5 things on your plate if thats at all possible. Not everything needs to be done today, and not every email needs to be responded to.
* Push some things to tomorrow and the rest of the week. If you have deadlines that can be pushed back (or renegotiated), do that. Spread the work out over the week, even into next week. What needs to be done tomorrow? What can wait a day or two longer?
* Eliminate what you can. That might mean just not replying to some messages that arent that important and dont really require a reply. It might mean telling some people that you cant take on this project after all, or that you need to get out of the commitment that you said youd do. Yes, this is uncomfortable. For now, just put them on a list called, “To Not Do,” and plan to figure out how to get out of them later.
OK, you have some breathing room and a manageable list now! Lets shrink that down even further and just pick one thing.
## Next: Focus on One Thing
With a lot on your plate, its hard to pick one thing to focus on. But thats exactly what Im going to ask you to do.
Pick one thing, and give it your focus. Yes, there are a lot of other things you can focus on. Yes, theyre stressing you out and making it hard to focus. But think about it this way: if you allow it all to be in your head all the time, that will always be your mode of being. Youll always be thinking about everything, stressing out about it all, with a frazzled mind … unless you start shifting.
The shift:
* Pick something to focus on. Look at the triaged list from the first section … if you have 5-6 things on this Short List, you can assess whether theres any super urgent, time-sensitive things you need to take care of. If there are, pick one of them. If not, pick the most important one — probably the one you have been putting off doing.
* Clear everything else away. Just for a little bit. Close all browser tabs, turn off notifications, close open applications, put your phone away.
* Put that one task before you, and allow yourself to be with it completely. Pour yourself into it. Think of it as a practice, of letting go (of everything else), of focus, of radical simplicity.
When youre done (or after 15-20 minutes have gone by at least), you can switch to something else. But dont allow yourself to switch until then.
By closing off all exits, by choosing one thing, by giving yourself completely to that thing … youre now in a different mode that isnt so stressful or spread thin. Youve started a shift that will lead to focus and sanity.
## Third: Schedule Time to Simplify
Remember the To Not Do list above? Schedule some time this week to start reducing your projects, saying no to people, getting out of commitments, crossing stuff off your task list … so that you can have some sanity back.
There are lots of little things that youve said “yes” to that you probably shouldnt have. Thats why youre overloaded. Protect your more important work, and your time off, and your peace of mind, by saying “no” to things that arent as important.
Schedule the time to simplify — you dont have to do it today, but sometime soon — and you can then not have to worry about the things on your To Not Do list until then.
## Fourth: Practice Mindful Focus
Go through the rest of the day with an attitude of “mindful focus.” That means that you are doing one thing at a time, being as present as you can, switching as little as you can.
Think of it as a settling of the mind. A new mode of being. A mindfulness practice (which means you wont be perfect at it).
As you practice mindful focus, youll learn to practice doing things with an open heart, with curiosity and gratitude, and even joy. Try these one at a time as you get to do each task on your Short List.
Youll find that youre not so overloaded, but that each task is just perfect for that moment. And thats a completely new relationship with the work that you do, and a new relationship with life.

View file

@ -0,0 +1,40 @@
---
title: "Fearlessness: How to Stop Running from Space"
date: 2018-03-18T12:13:30+05:30
tags: [Space]
---
We spend our days filling in every available space, cramming in more tasks, responding to messages, checking social media and online sites, watching videos.
We are afraid of empty space in our lives.
The result is often a continual busyness, constant distraction and avoidance, lack of focus, lack of satisfaction with our lives.
We run from silence. We run from the spaces between tasks and appointments. We run from solitude and stillness. We try to fill every second with activity, with something useful, as if silence and space are not valuable.
But what are we afraid of?
And who would we be if we didnt have that fear?
Were afraid of space and stillness and silence because it highlights the uncertainty, instability, groundlessness, insecurity, shakiness that lie underneath every second of our lives. Were afraid of having to face this instability and uncertainty, of having to feel the fear of it.
Without the fear of all of the uncertainty that is highlighted by space … we become free.
I know in my life, when I allow myself to have stillness, silence, solitude, simplicity and space … it leaves room to face whatever is coming up for me. It gives me room to fully feel any feelings that Ive been avoiding. It allows me to be more honest with myself, instead of using distractions and busyness to cover up what I dont want to see.
And in the end, I develop trust that the space is not something to be feared, but rather something to be treasured. A gift, filled with learning and not knowing and shakiness and beauty.
You might try allowing more space to be in your day, without filling it:
* Take some time between tasks for stillness.
* Sit out in nature, in silence, without technology.
* When you notice yourself reaching for your phone, pause. See if you can just be still, just savor some space.
* When you feel uncertainty or instability in your life (hint: its always there), let yourself feel it. Be present with it, without needing to run or avoid.
* When you feel fear, be open-hearted with it and allow yourself fully feel it, being friendly with it. Your relationship with fear will change if you become friendly with it.
* Do less, and trust that things wont fall apart. Or if they do fall apart, you can be present with that instability.
* When youre in line, driving, eating, walking, exercising … see if you can do those things in silence, without technology, without needing to do something “useful.” Find the value in these spaces.
* Notice who you are without the fear of space.
Savor these spaces, their deliciousness. Savor the groundlessness, as something filled with freedom if we learn not to fear it. Be present with the fear and uncertainty, as good friends not as enemies.
Let your heart be open raw tender and vulnerable, and your mind embracing the spaciousness of the vast blue sky of open awareness.

View file

@ -0,0 +1,38 @@
---
title: "How I Learned to Stop Procrastinating, & Love Letting Go"
date: 2018-03-18T12:13:32+05:30
description: "The art of letting go."
tags: [Procrastinating]
---
The end of procrastination is the art of letting go.
Ive been a lifelong procrastinator, at least until recent years. I would put things off until deadline, because I knew I could come through. I came through on tests after cramming last minute, I turned articles in at the deadline after waiting until the last hour, I got things done.
Until I didnt. It turns out procrastinating caused me to miss deadlines, over and over. It stressed me out. My work was less-than-desirable when I did it last minute. Slowly, I started to realize that procrastination wasnt doing me any favors. In fact, it was causing me a lot of grief.
But I couldnt quit. I tried a lot of things. I tried time boxing and goal setting and accountability and the Pomodoro Technique and Getting Things Done. All are great methods, but they only last so long. Nothing really worked over the long term.
Thats because I wasnt getting to the root problem.
I hadnt figured out the skill that would save me from the procrastination.
Until I learned about letting go.
Letting go first came to me when I was quitting smoking. I had to let go of the “need” to smoke, the use of my crutch of cigarettes to deal with stress and problems.
Then I learned I needed to let go of other false needs that were causing me problems: sugar, junk food, meat, shopping, beer, possessions. Im not saying I can never do these things again once I let go of these needs, but I let go of the idea that theyre really necessary. I let go of an unhealthy attachment to them.
Then I learned that distractions and the false need to check my email and news and other things online … were causing me problems. They were causing my procrastination.
So I learned to let go of those too.
Heres the process I used to let go of the distractions and false needs that cause procrastination:
I paid attention to the pain they cause me, later, instead of only the temporary comfort/pleasure they gave me right away.
I thought about the person I want to be, the life I want to live. I set my intentions to do the good work I think I should do.
I watched my urges to check things, to go to the comfort of distractions. I saw that I wanted to escape discomfort of something hard, and go to the comfort of something familiar and easy.
I realized I didnt need that comfort. I could be in discomfort and nothing bad would happen. In fact, the best things happen when Im in discomfort.
And then I smile, and breathe, and let go.
And one step at a time, become the person I want to be.

View file

@ -0,0 +1,30 @@
---
title: "Getting Started with Traveling Ultralight"
date: 2020-03-18T12:13:35+05:30
description: "Start by getting a small backpack (less than 20 liters) and then just travel with what fits in that."
---
Im on a trip at the moment, and a friend who generously let me sleep on his couch looked at my small travel backpack and commented on how little I travel with: “Thats impressive,” he said.
I was a little surprised, because though Ive gotten that comment before, its become normal for me to travel with just a small bag (10 lbs. or less, usually), and I have friends who travel with even less. But then I remembered that Im far from normal in this way.
I gave him a tip for getting started, and I recommend it for all of you, who want to travel light — or ultralight, as I call it, because for many people traveling light is taking a carry-on roller luggage. For me, having those roller bags is lugging too much, because you can run up stairs with it with ease, or carry it all over a city without worrying about stowing away your luggage somewhere first. Its so much easier to travel ultralight.
Heres the tip I gave him to get started: start by getting a small backpack (less than 20 liters) and then just travel with what fits in that.
Thats how to start. But youll probably want some guidance on what to put into the bag, and how to travel with so little. Heres some guidance to get started:
* I travel with a lightweight laptop (Macbook Air), a few clothes, my phone, earbuds and some charging cords, toiletries, and almost nothing else. A lightweight windbreaker for wind and light rain (Patagonia Houdini). An eye mask and ear plugs. A collapsible water bottle. My passport. Thats about it. No extra shoes. No books. No suit. No travel pillow. No extra camera other than my phone. Im not sure what else everyone else brings, but none of that.
* I bring clothes that I can wash in the sink or shower and that will dry overnight. Lightweight stuff that I can layer. Often theyre workout-style clothes or things from companies like Outlier or Patagonia that travel well. I dont bring enough underwear or socks for every day of the trip, because I wash them every couple of days. I only bring one or two extra T-shirts, generally wearing the same two shirts the whole trip, even if its a month long. No one has ever once cared what I wear when Im traveling.
* I bring minimal toiletries: a small shaver for my head, razor, toothbrush, floss small tubes of toothpaste and shaving cream, deodorant, nail clippers, ibuprofen.
* For cold places, I have thermal underwear and a couple long-sleeve layers (generally all Patagonia capilene stuff), and a beanie. I dont usually go to places where its snowing (I dont know why, maybe snow isnt my thing), so I dont have clothes to deal with that weather.
* For warm places, I will bring flip flops and swim trunks, and leave most of the colder layers behind.
Thats enough for a monthlong trip, which Ive done multiple times with this kind of setup. For a shorter trip of a few days, I might bring even less.
I really love traveling this way, and am more than willing to sacrifice bringing extra things for the luxury of traveling lightweight.
By the way, you dont need much more than this kind of setup even in everyday life.
For more info on this, check out my Ultralight ebook, and my friend Tynan has a great book called Forever Nomad.

View file

@ -0,0 +1,75 @@
---
title: "Typography"
date: 2018-03-18T12:13:38+05:30
---
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
# Heading 1
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
## Heading 2
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
### Heading 3
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
#### Heading 4
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
##### Heading 5
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
###### Heading 6
Lid est laborum et dolorum fuga. Et harum quidem rerum facilis est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit quo minus id quod amets untra dolor amet sad. Sed ut perspser iciatis unde omnis iste natus error sit voluptatem accusantium doloremque laste. Dolores sadips ipsums sits.
## Typography
Lid est laborum et dolorum fuga, This is [an example](http://example.com/ "Title") inline link. Et harum quidem rerum facilis, **This is bold** and *emphasis* cumque nihilse impedit quo minus id quod amets untra dolor amet sad. While this is `code block()` and following is a `pre` tag
print 'this is pre tag'
Following is the syntax highlighted code block
```go
func getCookie(name string, r interface{}) (*http.Cookie, error) {
rd := r.(*http.Request)
cookie, err := rd.Cookie(name)
if err != nil {
return nil, err
}
return cookie, nil
}
func setCookie(cookie *http.Cookie, w interface{}) error {
// Get write interface registered using `Acquire` method in handlers.
wr := w.(http.ResponseWriter)
http.SetCookie(wr, cookie)
return nil
}
```
This is blockquote, Will make it *better now*
> 'I want to do with you what spring does with the cherry trees.' <cite>cited ~Pablo Neruda</cite>*
> Et harum quidem *rerum facilis* est et expeditasi distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihilse impedit
Unordered list
* Red
* Green
* Blue
Ordered list
1. Red
2. Green
3. Blue

View file

@ -0,0 +1,36 @@
---
title: "Hugo shortcodes"
date: 2018-03-18T12:13:36+05:30
description: Here is a demo of all shortcodes available in Hugo.
---
## Images
{{< figure src="https://images.unsplash.com/photo-1560032779-0a8809186efd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" title="Dave Herring" >}}
{{< figure src="https://images.unsplash.com/photo-1560032779-0a8809186efd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80" title="Dave Herring" >}}
## Github Gist
{{< gist spf13 7896402 >}}
## Youtube video
{{< youtube w7Ft2ymGmfc >}}
## Tweet
{{< tweet 877500564405444608 >}}
## Vimeo
{{< vimeo id="146022717" >}}
## Instagram
{{< instagram BWNjjyYFxVx >}}
## Callouts
{{< callout emoji="⚡️" text="I guess this works" >}}

View file

@ -0,0 +1,15 @@
---
title: "How to test dark mode?"
summary: "Here is how you can setup dark mode for Ink and test on various OS like iOS, Android, macOS and Windows 10."
date: 2018-03-18T12:13:38+05:30
tldr: "Wubba lubba dub dub"
---
You can set dark mode as default by setting `params.mode` to `dark` in `config.toml` or set it to `auto` which will detect based on your OS and switch to dark mode. For more details [refer documentation](https://github.com/knadh/hugo-ink#configuration)
Here is how you can switch based on your OS
* [iOS](https://www.howtogeek.com/440078/how-to-enable-dark-mode-on-your-iphone-and-ipad/)
* [Android](https://9to5google.com/2018/12/17/android-dark-mode-theme-pie/)
* [macOS](https://support.apple.com/en-in/HT208976)
* [Windows 10](https://www.cnet.com/how-to/turn-on-the-dark-mode-in-windows-10/)

View file

@ -0,0 +1,382 @@
---
title: Telegram Bot for GitHub Actions
date: "2020-04-01"
description: Make a Telegram bot with Node.js and use it with GitHub Actions for sending notifications to you about the repo.
tldr: Making GitHub Actions with Js Code
---
## Telegram
[Telegram](https://telegram.org/) is a cloud-based mobile and desktop messaging app with a focus on security and speed. It is free to use and extensively hackable. It also has a good bot support system. The API is also easy to implement and has many wrappers for building bots with the API.
## GitHub Actions
[GitHub Actions](https://github.com/features/actions) is a CI/CD runtime for your GitHub repository. You can run almost anything from scripts to docker containers. You can build, test and deploy your code with GitHub Actions. All these actions are called workflows and workflows differ in the job they're doing. These maybe test workflows, build ones or deployment ones. You can find all the actions on GitHub in the [marketplace](https://github.com/marketplace?type=actions)
## Building the Bot
### Prerequisites
- Basic JavaScript Knowledge
- Basic GitHub Knowledge
- Telegram Account
> There are templates for building actions. Here we're gonna start from scratch
### Environment Setup
- **Node**, You can download node from their [website](https://nodejs.org/en/download/)
- NPM comes with node, so you don't have to worry about it.
- Initialize the Project
```shell
$ git init ## initialize a new git repository for version management
---
$ npm init
```
- **dotenv**, Dotenv can be downloaded via
```shell
$ npm i dotenv
---
$ yarn add dotenv
```
- **node-telegram-bot-api**, node-telegram-bot-api is a simple wrapper for building telegram bots. You can download it via
```shell
$ npm i node-telegram-bot-api
---
$ yarn add node-telegram-bot-api
```
- **@zeit/ncc**, NCC is a Simple CLI for compiling a Node.js module into a single file, together with all its dependencies, GCC-style. It's a dev dependency and can be downloaded
```shell
yarn add --dev @zeit/ncc
---
npm i -D @zeit/ncc
```
#### Folder Structure
The `dist` folder will be automatically created. `action.yml` will be made
```
.
├── dist
│ └── index.js
├── index.js
├── action.yml
├── README.md
└── package.json
```
- `index.js` is the file we're defining the bot
- `action.yml` is the file we'll define the action and it's behaviours
## Making the Bot
We need to get an API bot token from telegram. For that Go to Telegram and Search for `Botfather`. It's a bot.
![](bfather.png)
Create a new bot with the `/newbot` command and get the API key. We'll need that, also talk to `jsondump` bot and get your chat id. The output may be like this, so
```json
{
"update_id": 143943779,
"message": {
"message_id": 181575,
"from": {
"id": 123456 // this is what we need
"is_bot": false,
"first_name": "Tg Name",
"username": "TG Username",
"language_code": "en"
},
"chat": {
"id": 123456,
"first_name": "Tg Name",
"username": "TG Username",
"type": "private"
},
"date": 1584119424,
"text": "message"
}
}
```
This will be needed for further use and We need to add it to the repo secrets which can be found in the repo settings. Be careful to add it as `token` and `chat` like as shown below
![](scr.png)
### Writing the Action and Building the Bot
Fire up the terminal/cmd and make a new folder. Install the dependencies. Run the following command
```shell
$ touch index.js action.yml
```
Open your favourite text editor within the folder or with the file. We'll define the bot in `index.js`
```javaScript
require("dotenv").config
const Bot = require('node-telegram-bot-api');
const {
INPUT_STATUS: ipstatus,
INPUT_TOKEN: tgtoken,//Telegram api token
INPUT_CHAT: chatid,// Telegram Chat ID
INPUT_IU_TITLE: ititle,// Issue title
INPUT_IU_NUM: inum,// Issue Number
INPUT_IU_ACTOR: iactor,// Issue made by
INPUT_IU_BODY: ibody,// Issue Body
INPUT_PR_NUM: pnum,// PR Number
INPUT_PR_STATE: prstate,// PR Opened, reponed or closed
INPUT_PR_TITLE: ptitle,// PR Title
INPUT_PR_BODY: pbody,// Body of the PR
GITHUB_EVENT_NAME: ghevent,// Name of the trigger event
GITHUB_REPOSITORY: repo,// Repository the trigger was made from
GITHUB_ACTOR: ghactor,// User who triggered the action
GITHUB_SHA: sha,// Commit ID
GITHUB_WORKFLOW: ghwrkflw// Workflow Name
} = process.env;
const bot = new Bot(tgtoken)
```
First, we're defining the dotenv for config and initializing Telegram Bot. Here we're defining the alias variables for the *environment variables*. You might notice an `INPUT_` for almost every environment variable, this is because GitHub Actions pass the env variable with an INPUT prefix. Other env variables are action's default environment variables. Then we initialized the bot with the API token.
GitHub actions could be triggered with Issues, Pull Request or Pushes. You can find the trigger events [here](https://help.github.com/en/actions/reference/events-that-trigger-workflows). Here we're gonna get a message from the bot when an *Issue* or *Pull Request* or a *Push* event has happened.
```js
const evresp = (gevent) => {
switch (gevent) {
case "issues":
return `
❗️❗️❗️❗️❗️❗️
Issue ${prstate}
Issue Title and Number : ${ititle} | #${inum}
Commented or Created By : \`${iactor}\`
Issue Body : *${ibody}*
[Link to Issue](https://github.com/${repo}/issues/${inum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
case "pull_request":
return `
🔃🔀🔃🔀🔃🔀
PR ${prstate}
PR Number: ${pnum}
PR Title: ${ptitle}
PR Body: *${pbody}*
PR By: ${ghactor}
[Link to Issue](https://github.com/${repo}/pull/${pnum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
default:
return `
⬆️⇅⬆️⇅
ID: ${ghwrkflw}
Action was a *${ipstatus}!*
\`Repository: ${repo}\`
On: *${ghevent}*
By: *${ghactor}*
Tag: ${process.env.GITHUB_REF}
[Link to Repo ](https://github.com/${repo}/)
`
}
}
```
In these lines of code, we're just initializing a switch statement for the responses. We're also declaring an anonymous function to use the switch responses via a function later. We're using all the defined variables in the switch. You can check the [trigger Events](https://help.github.com/en/actions/reference/events-that-trigger-workflows) to get how the event is triggered and what keyword should be used.
Now for the last part of the Js file, we just take the response from the switch and assign it to a constant. Then we use the `sendMessage` function of the `node-telegram-bot-api` to send the message to the bot with the chatid and the output as the arguments.
```js
const output = evresp(ghevent)
```
bot.sendMessage(chatid,output,{parse_mode : "Markdown"})
## Compiling and Minifying the Js code
Since we have installed `@zeit/ncc` and this is used for the making the whole program with all the APIs to a single file and we need to use NCC for that. We just need to run
```shell
yarn run ncc build index.js -C -m -o dist
```
or you might wanna add the following to you `package.json` file, and run `npm run test` to compile and minify the code.
```json
"scripts": {
"test": "ncc build index.js -C -m -o dist"
},
```
This will create a `dist` folder with and `index.js` file which contains the compiled code.
## Making it a valid action
For making this Js file a valid action, we need to add an `action.yml` file. The action.yml for this action is like this
```yml
name: 'Action Name'
description: 'Action Descreption'
author: '<author name>'
inputs:
chat:
description: 'Chat to send: chat id or @channel_name'
required: true
token:
description: 'Telegram Bot token'
required: true
status:
description: 'Job status'
required: true
iu_title:
description: 'Issue Title'
default: ${{ github.event.issue.title }}
iu_num:
description: 'Issue Number'
default: ${{ github.event.issue.number }}
iu_actor:
description: 'Issue Triggerer'
default: ${{ github.event.issue.user.login }}
iu_com:
description: 'Issue Comment'
default: ${{github.event.comment.body}}
pr_state:
description: 'State of the PR'
default: ${{ github.event.action }}
pr_num:
description: 'PR Number'
default: ${{ github.event.number }}
pr_title:
description: 'Title of the PR'
default: ${{ github.event.pull_request.title }}
pr_body:
description: 'Body/Contents of the PR'
default: ${{ github.event.pull_request.body }}
runs:
using: "node12"
main: "dist/index.js"
branding:
icon: 'repeat'
color: 'green'
```
Here we're defining the Input variables to be loaded for the action in GitHub's runtime environemt. All these `default` data are taken from the response of the webhooks which are send by GitHub when a trigger event is occured. You can find out more in the [Action Documentation Here](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context).
```yml
runs:
using: "node12"
main: "dist/index.js"
```
Here we are defining that this is a node action and should run in an environment with node, and the file which should be run, here the `index.js` file in the `dist` folder. That should do it. Create a new commit and push it to a repo. **Create a new tag** and this action will appear in the [marketplace](https://github.com/marketplace?type=actions).
### Defining a workflow to test your action
GitHub Action workflows are defined using the `.yml` syntax. Here is an example of a sample workflow for this action
```yml
name: <Workflow Name>
on:
push:
pull_request:
types: [opened, closed]
issues:
types: [opened, closed, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: <AnyName>
uses: <username>/<repo>@master
if: always()
with:
chat: ${{ secrets.chat }}
token: ${{ secrets.token }}
status: ${{ job.status }}
```
The Complete code for the bot is
```js
//Initializing dotenv and the bot
require("dotenv").config
const Bot = require('node-telegram-bot-api');
// aliasing the environment variables
const {
INPUT_STATUS: ipstatus,
INPUT_TOKEN: tgtoken, //Telegram api token
INPUT_CHAT: chatid,// Telegram Chat ID
INPUT_IU_TITLE: ititle,// Issue title
INPUT_IU_NUM: inum,// Issue Number
INPUT_IU_ACTOR: iactor, // Issue made by
INPUT_IU_BODY: ibody, // Issue Body
INPUT_PR_NUM: pnum, // PR Number
INPUT_PR_STATE: prstate, // PR Opened, reponed or closed
INPUT_PR_TITLE: ptitle, // PR Title
INPUT_PR_BODY: pbody, // Body of the PR
GITHUB_EVENT_NAME: ghevent, // Name of the trigger event
GITHUB_REPOSITORY: repo, // Repository the trigger was made from
GITHUB_ACTOR: ghactor, // User who triggered the action
GITHUB_SHA: sha, // Commit ID
GITHUB_WORKFLOW: ghwrkflw // Workflow Name
} = process.env;
const bot = new Bot(tgtoken)
// Function to return the response for the specific trigger
const evresp = (gevent) => {
switch (gevent) {
//Switch statement for issues
case "issues":
return `
❗️❗️❗️❗️❗️❗️
Issue ${prstate}
Issue Title and Number : ${ititle} | #${inum}
Commented or Created By : \`${iactor}\`
Issue Body : *${ibody}*
[Link to Issue](https://github.com/${repo}/issues/${inum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
// Switch statement for Pull Requests
case "pull_request":
return `
🔃🔀🔃🔀🔃🔀
PR ${prstate}
PR Number: ${pnum}
PR Title: ${ptitle}
PR Body: *${pbody}*
PR By: ${ghactor}
[Link to Issue](https://github.com/${repo}/pull/${pnum})
[Link to Repo ](https://github.com/${repo}/)
[Build log here](https://github.com/${repo}/commit/${sha}/checks)`
default:
// switch statement for Pushes
return `
⬆️⇅⬆️⇅
ID: ${ghwrkflw}
Action was a *${ipstatus}!*
\`Repository: ${repo}\`
On: *${ghevent}*
By: *${ghactor}*
Tag: ${process.env.GITHUB_REF}
[Link to Repo ](https://github.com/${repo}/)
`
}
}
// assigning the output to a variable
const output = evresp(ghevent)
// sending the message
bot.sendMessage(chatid,output,{parse_mode : "Markdown"})
```
------
You can try out many different items using actions and this is just a sample action to get you started. Maybe sending Cat GIFs if the build succeded on the pull request or sending a welcome message to a first time contributor. You imagination is the limit😄 and **Never Stop being ⚡️**

View file

@ -1,7 +1,12 @@
<footer> <footer>
<a href="https://github.com/athul">GitHub</a> | {{- range $index, $key := .Site.Params.Social -}}
{{ with .Site.Copyright }} {{ . }} | {{ end }} <a href="https://github.com/athul/archie-theme">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a> <a href="{{ $key.url }}" title="{{ $key.name }}"><i data-feather="{{ $key.icon }}"></i></a>|
{{- end -}}
{{ with .Site.Copyright }} {{ . }} | {{ end }} <a href="https://github.com/athul/archie">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a>
</footer> </footer>
{{ if not .Site.IsServer }} {{ if not .Site.IsServer }}
{{ template "_internal/google_analytics_async.html" . }} {{ template "_internal/google_analytics_async.html" . }}
{{ end }} {{ end }}
<script>
feather.replace()
</script>

View file

@ -20,6 +20,11 @@
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}} {{- template "_internal/twitter_cards.html" . -}}
{{ if and (isset .Site.Params "social") (isset .Site.Params "feathericonscdn") (eq .Site.Params.featherIconsCDN true) -}}
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
{{- else if (isset .Site.Params "social") -}}
<script src="{{ .Site.BaseURL }}js/feather.min.js"></script>
{{ end }}
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}css/main.css" /> <link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}css/main.css" />
@ -30,5 +35,4 @@
<script src="{{ $.Site.BaseURL }}{{ . }}"></script> <script src="{{ $.Site.BaseURL }}{{ . }}"></script>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
</head> </head>

View file

@ -1,5 +1,4 @@
/* Fonts */ /* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans&family=IBM+Plex+Sans&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap'); @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap');
/* Markdown */ /* Markdown */
html { html {
@ -232,3 +231,10 @@ justify-content: space-between;
.tags a{ .tags a{
border-bottom: 3px solid blue; border-bottom: 3px solid blue;
} }
svg{
max-height: 15px;
}
footer a:hover{
background-color: hotpink;
color: white;
}

13
static/js/feather.min.js vendored Normal file

File diff suppressed because one or more lines are too long

0
static/js/main.js Normal file
View file