<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 81CuongVn</title>
    <description>The latest articles on DEV Community by 81CuongVn (@81cuongvn).</description>
    <link>https://dev.to/81cuongvn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F859109%2F3f230e3f-d2ba-480a-8ec8-0b9d7f9a4f38.png</url>
      <title>DEV Community: 81CuongVn</title>
      <link>https://dev.to/81cuongvn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/81cuongvn"/>
    <language>en</language>
    <item>
      <title>AdaGPT: My Learnings While Building a GitHub Action</title>
      <dc:creator>81CuongVn</dc:creator>
      <pubDate>Mon, 08 May 2023 04:57:56 +0000</pubDate>
      <link>https://dev.to/81cuongvn/adagpt-my-learnings-while-building-a-github-action-165h</link>
      <guid>https://dev.to/81cuongvn/adagpt-my-learnings-while-building-a-github-action-165h</guid>
      <description>&lt;p&gt;&lt;code&gt;AdaGPT (2 Part Series)&lt;/code&gt;&lt;br&gt;
1&lt;br&gt;
&lt;code&gt;AdaGPT: AI support for Issues and Pull Requests right at your fingertips!&lt;/code&gt;&lt;br&gt;
2&lt;br&gt;
&lt;code&gt;AdaGPT: My Learnings While Building a GitHub Action&lt;/code&gt;&lt;br&gt;
I posted my GitHub Action, AdaGPT, for the GitHub Hackathon here on DEV.to a few days ago. While implementing this action, I learned a lot and want to take the time to share them. Here are my learnings in no particular order:&lt;/p&gt;

&lt;p&gt;Action Templates&lt;br&gt;
To get started quickly with a JavaScript action, I recommend using the official templates from GitHub for JavaScript and TypeScript.&lt;/p&gt;

&lt;p&gt;TypeScript Types&lt;br&gt;
Life is easier with static types, at least for me. If you use TypeScript, GitHub provides the @octokit/webhooks-types package with official type definitions for all of GitHub's webhooks event types and payloads.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;});&lt;br&gt;
The REST API client for JavaScript has extensive documentation with many code examples.&lt;/p&gt;

&lt;p&gt;GitHub Context&lt;br&gt;
The package @actions/github provides a hydrated Context from the current workflow environment with lots of useful information.&lt;/p&gt;

&lt;p&gt;The current repository and issue number can be retrieved directly from context instead of providing them via an input or reading them from an environment variable:&lt;br&gt;
import * as core from '@actions/core'&lt;br&gt;
import * asfrom '@actions/'&lt;/p&gt;

&lt;p&gt;//---------------------------------------------------------&lt;/p&gt;

&lt;p&gt;Run Action Locally&lt;br&gt;
You can use the act package to run your workflow and action locally so you don't have to commit and push every time you want to test the changes. It works really well and helps you develop much faster.&lt;/p&gt;

&lt;p&gt;If you run the workflow locally, you will not get an automatic GitHub Token for interacting with the REST API. This means you need to create a Personal Access Token and provide this token as GITHUB_TOKEN for workflow execution. I would recommend creating a local .env file with your PAT:&lt;/p&gt;

&lt;h1&gt;
  
  
  file: .env
&lt;/h1&gt;

&lt;p&gt;GITHUB_TOKEN=&lt;br&gt;
This secret file can be passed to act when running locally:&lt;br&gt;
act issue_comment --secret-file .env&lt;br&gt;
As usual, the token is available within the workflow via the syntax ${ secrets.}}.&lt;/p&gt;

&lt;p&gt;Pagination&lt;br&gt;
The REST API is paginated and returns up to 100 items per page. You can use Pagination API to read all items of a particular endpoint:&lt;br&gt;
import * as core from '@actions/core'&lt;br&gt;
import * as githb from '@actions/'&lt;br&gt;
import type { Issue } from '@/webhooks-types';&lt;/p&gt;

&lt;p&gt;});&lt;br&gt;
Write Job Summary&lt;br&gt;
The Job Summary is a markdown file with the results of the jobs within a workflow. This blog post from GitHub gives a good overview.&lt;/p&gt;

&lt;p&gt;For example, I'm writing this job summary for my GitHub Action:&lt;br&gt;
import * as core from '@actions/core'&lt;br&gt;
import * as github from '@actions/github'&lt;/p&gt;

&lt;p&gt;a&lt;br&gt;
  .write();&lt;br&gt;
The rendered markdown looks like this:&lt;/p&gt;

&lt;p&gt;Job Summary&lt;/p&gt;

&lt;p&gt;Job Summary&lt;br&gt;
I hope you found this post helpful. If you have any questions or comments, feel free to leave them below. If you'd like to connect with me, you can find me on LinkedIn or GitHub. Thanks for reading!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>github</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Log Server dev for bot developer something</title>
      <dc:creator>81CuongVn</dc:creator>
      <pubDate>Sun, 17 Jul 2022 11:06:13 +0000</pubDate>
      <link>https://dev.to/81cuongvn/log-server-dev-for-bot-developer-something-5dn2</link>
      <guid>https://dev.to/81cuongvn/log-server-dev-for-bot-developer-something-5dn2</guid>
      <description></description>
    </item>
    <item>
      <title>haiz ....</title>
      <dc:creator>81CuongVn</dc:creator>
      <pubDate>Sun, 08 May 2022 07:04:30 +0000</pubDate>
      <link>https://dev.to/81cuongvn/haiz--2pba</link>
      <guid>https://dev.to/81cuongvn/haiz--2pba</guid>
      <description></description>
    </item>
  </channel>
</rss>
