<?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: Jirawat Boonkumnerd</title>
    <description>The latest articles on DEV Community by Jirawat Boonkumnerd (@ntsd).</description>
    <link>https://dev.to/ntsd</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F363628%2F2a9fe6e6-d6dd-41a5-870b-437f87cd68c1.jpeg</url>
      <title>DEV Community: Jirawat Boonkumnerd</title>
      <link>https://dev.to/ntsd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ntsd"/>
    <language>en</language>
    <item>
      <title>Auto Request Changes review when the job failed using Github Action</title>
      <dc:creator>Jirawat Boonkumnerd</dc:creator>
      <pubDate>Sun, 21 Nov 2021 17:19:00 +0000</pubDate>
      <link>https://dev.to/ntsd/auto-request-changes-review-when-the-job-failed-using-github-action-41cc</link>
      <guid>https://dev.to/ntsd/auto-request-changes-review-when-the-job-failed-using-github-action-41cc</guid>
      <description>&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;The Github Action is forked from &lt;a href="https://github.com/hmarr/auto-approve-action"&gt;hmarr/auto-approve-action&lt;/a&gt;. The action will automatically create a &lt;code&gt;Request Changes&lt;/code&gt; pull request review. A use case is to create a request changes review when a workflow job failed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lYaTDwm2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/thy53zlz4uvhuqljg3k2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lYaTDwm2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/thy53zlz4uvhuqljg3k2.png" alt="auto-request-changes-action" width="880" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The action support 3 input parameters. You can use with &lt;a href="https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswith"&gt;jobs..steps[*].with&lt;/a&gt; to add the input parameters.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;github-token&lt;/code&gt;: The Github token. By default, it will using &lt;code&gt;${{ github.token }}&lt;/code&gt; to use the repo token.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;comment-body&lt;/code&gt;: The comment body to create a request changes review. The &lt;code&gt;comment-body&lt;/code&gt; also support markdown text by Github. The default is &lt;code&gt;Some actions are not successful, please fix it&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pull-request-number&lt;/code&gt;: (optional) The ID of a pull request to auto-request-changes. By default, this action tries to use the pull_request event payload.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example use
&lt;/h3&gt;

&lt;p&gt;you can use with &lt;code&gt;if&lt;/code&gt; to avoid no pull request event and run only when the job failed. &lt;/p&gt;

&lt;p&gt;*for more &lt;a href="https://docs.github.com/en/actions/learn-github-actions/contexts"&gt;Github Action Context&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Auto request changes
on: pull_request_target

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: ntsd/auto-request-changes-action@v2
        if: ${{ github.event.pull_request &amp;amp;&amp;amp; failure() }}
        with:
          comment-body: "The job ran failed please fix it."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can also use it with &lt;code&gt;auto-approve-action&lt;/code&gt; to make it auto approve when the job success.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Auto request changes
on: pull_request_target

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: ntsd/auto-request-changes-action@v2
        if: ${{ github.event.pull_request &amp;amp;&amp;amp; failure() }}
        with:
          comment-body: "The job ran failed please fix it."
      - uses: hmarr/auto-approve-action@v2
        if: ${{ github.event.pull_request &amp;amp;&amp;amp; success() }}
        with:
          github-token: "${{ secrets.GITHUB_TOKEN }}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Maintainer Must-Haves&lt;/p&gt;
&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ntsd"&gt;
        ntsd
      &lt;/a&gt; / &lt;a href="https://github.com/ntsd/auto-request-changes-action"&gt;
        auto-request-changes-action
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      👍 GitHub Action for automatically request changes GitHub pull requests
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Auto Request Changes GitHub Action&lt;/h1&gt;
&lt;p&gt;This action is a fork from &lt;a href="https://github.com/hmarr/auto-approve-action"&gt;hmarr/auto-approve-action&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;code&gt;ntsd/auto-request-changes-action&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Automatically request changes GitHub pull requests. The &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; secret will default provided as the &lt;code&gt;github-token&lt;/code&gt; input for the action to work. otherwise you can add a token to &lt;code&gt;github-token&lt;/code&gt; input.&lt;/p&gt;
&lt;h2&gt;
Why?&lt;/h2&gt;
&lt;p&gt;Because sometimes you want to automate create request changes review. for example, create a request changes review when a lint or testing workflow is failed.&lt;/p&gt;
&lt;h2&gt;
Usage instructions&lt;/h2&gt;
&lt;p&gt;Create a workflow file (e.g. &lt;code&gt;.github/workflows/auto-request-changes.yml&lt;/code&gt;) that contains a step that &lt;code&gt;uses: ntsd/auto-request-changes-action@v2&lt;/code&gt;. Here's an example workflow file:&lt;/p&gt;
&lt;p&gt;for all github action contexts check &lt;a href="https://docs.github.com/en/actions/learn-github-actions/contexts"&gt;https://docs.github.com/en/actions/learn-github-actions/contexts&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight highlight-source-yaml position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-ent"&gt;name&lt;/span&gt;: &lt;span class="pl-s"&gt;Auto request changes&lt;/span&gt;
&lt;span class="pl-ent"&gt;on&lt;/span&gt;: &lt;span class="pl-s"&gt;pull_request_target&lt;/span&gt;

&lt;span class="pl-ent"&gt;jobs&lt;/span&gt;:
  &lt;span class="pl-ent"&gt;build&lt;/span&gt;:
    &lt;span class="pl-ent"&gt;runs-on&lt;/span&gt;: &lt;span class="pl-s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="pl-ent"&gt;steps&lt;/span&gt;:
      - &lt;span class="pl-ent"&gt;uses&lt;/span&gt;: &lt;span class="pl-s"&gt;ntsd/auto-request-changes-action@v2&lt;/span&gt;
        &lt;span class="pl-ent"&gt;with&lt;/span&gt;:
          &lt;span class="pl-ent"&gt;github-token&lt;/span&gt;: &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;${{ secrets.GITHUB_TOKEN }}&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;
          &lt;span class="pl-ent"&gt;comment-body&lt;/span&gt;: &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;custom comment body&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Combine with an &lt;code&gt;if&lt;/code&gt; can only auto-request-changes with only failure workflow&lt;/p&gt;
&lt;div class="highlight highlight-source-yaml position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-ent"&gt;name&lt;/span&gt;: &lt;span class="pl-s"&gt;Auto&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ntsd/auto-request-changes-action"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/ntsd/auto-request-changes-action"&gt;Auto Request Changes Action Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/marketplace/actions/auto-request-changes"&gt;Auto Request Changes Action Marketplace&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hmarr/auto-approve-action"&gt;Auto Approve Action Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/learn-github-actions/contexts"&gt;Github Action Context&lt;/a&gt;&lt;/p&gt;

</description>
      <category>actionshackathon21</category>
      <category>github</category>
      <category>opensource</category>
      <category>action</category>
    </item>
  </channel>
</rss>
