diff mbox series

[1/1] Comment with contributing instructions on github pull request

Message ID 20220120065945.48281-1-james.hilliard1@gmail.com
State Accepted
Headers show
Series [1/1] Comment with contributing instructions on github pull request | expand

Commit Message

James Hilliard Jan. 20, 2022, 6:59 a.m. UTC
It seems a lot of users on github are not seeing the contributing
instructions and opening pull requests.

Automatically comment with the contributing instructions using
a github workflow so that they know where to submit their patch.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 .github/workflows/contributing.yml | 29 +++++++++++++++++++++++++++++
 .gitignore                         |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 .github/workflows/contributing.yml

Comments

Stefano Babic Jan. 20, 2022, 4:22 p.m. UTC | #1
Hi James,

On 20.01.22 07:59, James Hilliard wrote:
> It seems a lot of users on github are not seeing the contributing
> instructions and opening pull requests.
> 
> Automatically comment with the contributing instructions using
> a github workflow so that they know where to submit their patch.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>   .github/workflows/contributing.yml | 29 +++++++++++++++++++++++++++++
>   .gitignore                         |  1 +
>   2 files changed, 30 insertions(+)
>   create mode 100644 .github/workflows/contributing.yml
> 
> diff --git a/.github/workflows/contributing.yml b/.github/workflows/contributing.yml
> new file mode 100644
> index 0000000..82041d1
> --- /dev/null
> +++ b/.github/workflows/contributing.yml
> @@ -0,0 +1,29 @@
> +on:
> +  pull_request_target:
> +    types:
> +      - opened
> +
> +jobs:
> +  comment:
> +    runs-on: ubuntu-latest
> +    steps:
> +      - name: Install pandoc
> +        run: sudo apt-get install pandoc
> +      - uses: actions/github-script@v5
> +        with:
> +          script: |
> +            const contributing = await github.rest.repos.getContent({
> +              owner: context.repo.owner,
> +              repo: context.repo.repo,
> +              path: 'doc/source/contributing.rst',
> +            })
> +            options = {
> +              input: Buffer.from(contributing.data.content, 'base64')
> +            }
> +            mdout = await exec.getExecOutput('pandoc', ['-f', 'rst', '-t', 'gfm'], options)
> +            github.rest.issues.createComment({
> +              issue_number: context.issue.number,
> +              owner: context.repo.owner,
> +              repo: context.repo.repo,
> +              body: mdout.stdout
> +            })
> diff --git a/.gitignore b/.gitignore
> index 2742314..e178b7f 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -123,3 +123,4 @@ web-app/swupdate-www.tar.gz
>   
>   # ci
>   !.gitlab-ci.yml
> +!.github
> 


Applied to -master, thanks !

Best regards,
Stefano Babic
James Hilliard Jan. 20, 2022, 11:31 p.m. UTC | #2
On Thu, Jan 20, 2022 at 9:22 AM Stefano Babic <sbabic@denx.de> wrote:
>
> Hi James,
>
> On 20.01.22 07:59, James Hilliard wrote:
> > It seems a lot of users on github are not seeing the contributing
> > instructions and opening pull requests.
> >
> > Automatically comment with the contributing instructions using
> > a github workflow so that they know where to submit their patch.
> >
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> >   .github/workflows/contributing.yml | 29 +++++++++++++++++++++++++++++
> >   .gitignore                         |  1 +
> >   2 files changed, 30 insertions(+)
> >   create mode 100644 .github/workflows/contributing.yml
> >
> > diff --git a/.github/workflows/contributing.yml b/.github/workflows/contributing.yml
> > new file mode 100644
> > index 0000000..82041d1
> > --- /dev/null
> > +++ b/.github/workflows/contributing.yml
> > @@ -0,0 +1,29 @@
> > +on:
> > +  pull_request_target:
> > +    types:
> > +      - opened
> > +
> > +jobs:
> > +  comment:
> > +    runs-on: ubuntu-latest
> > +    steps:
> > +      - name: Install pandoc
> > +        run: sudo apt-get install pandoc
> > +      - uses: actions/github-script@v5
> > +        with:
> > +          script: |
> > +            const contributing = await github.rest.repos.getContent({
> > +              owner: context.repo.owner,
> > +              repo: context.repo.repo,
> > +              path: 'doc/source/contributing.rst',
> > +            })
> > +            options = {
> > +              input: Buffer.from(contributing.data.content, 'base64')
> > +            }
> > +            mdout = await exec.getExecOutput('pandoc', ['-f', 'rst', '-t', 'gfm'], options)
> > +            github.rest.issues.createComment({
> > +              issue_number: context.issue.number,
> > +              owner: context.repo.owner,
> > +              repo: context.repo.repo,
> > +              body: mdout.stdout
> > +            })
> > diff --git a/.gitignore b/.gitignore
> > index 2742314..e178b7f 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -123,3 +123,4 @@ web-app/swupdate-www.tar.gz
> >
> >   # ci
> >   !.gitlab-ci.yml
> > +!.github
> >
>
>
> Applied to -master, thanks !

Did a test here and it seems to be working pretty good:
https://github.com/sbabic/swupdate/pull/66#issuecomment-1018018085

>
> Best regards,
> Stefano Babic
>
> --
> =====================================================================
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
> =====================================================================
Stefano Babic Jan. 21, 2022, 12:35 p.m. UTC | #3
Hi james,

On 21.01.22 00:31, James Hilliard wrote:
> On Thu, Jan 20, 2022 at 9:22 AM Stefano Babic <sbabic@denx.de> wrote:
>>
>> Hi James,
>>
>> On 20.01.22 07:59, James Hilliard wrote:
>>> It seems a lot of users on github are not seeing the contributing
>>> instructions and opening pull requests.
>>>
>>> Automatically comment with the contributing instructions using
>>> a github workflow so that they know where to submit their patch.
>>>
>>> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
>>> ---
>>>    .github/workflows/contributing.yml | 29 +++++++++++++++++++++++++++++
>>>    .gitignore                         |  1 +
>>>    2 files changed, 30 insertions(+)
>>>    create mode 100644 .github/workflows/contributing.yml
>>>
>>> diff --git a/.github/workflows/contributing.yml b/.github/workflows/contributing.yml
>>> new file mode 100644
>>> index 0000000..82041d1
>>> --- /dev/null
>>> +++ b/.github/workflows/contributing.yml
>>> @@ -0,0 +1,29 @@
>>> +on:
>>> +  pull_request_target:
>>> +    types:
>>> +      - opened
>>> +
>>> +jobs:
>>> +  comment:
>>> +    runs-on: ubuntu-latest
>>> +    steps:
>>> +      - name: Install pandoc
>>> +        run: sudo apt-get install pandoc
>>> +      - uses: actions/github-script@v5
>>> +        with:
>>> +          script: |
>>> +            const contributing = await github.rest.repos.getContent({
>>> +              owner: context.repo.owner,
>>> +              repo: context.repo.repo,
>>> +              path: 'doc/source/contributing.rst',
>>> +            })
>>> +            options = {
>>> +              input: Buffer.from(contributing.data.content, 'base64')
>>> +            }
>>> +            mdout = await exec.getExecOutput('pandoc', ['-f', 'rst', '-t', 'gfm'], options)
>>> +            github.rest.issues.createComment({
>>> +              issue_number: context.issue.number,
>>> +              owner: context.repo.owner,
>>> +              repo: context.repo.repo,
>>> +              body: mdout.stdout
>>> +            })
>>> diff --git a/.gitignore b/.gitignore
>>> index 2742314..e178b7f 100644
>>> --- a/.gitignore
>>> +++ b/.gitignore
>>> @@ -123,3 +123,4 @@ web-app/swupdate-www.tar.gz
>>>
>>>    # ci
>>>    !.gitlab-ci.yml
>>> +!.github
>>>
>>
>>
>> Applied to -master, thanks !
> 
> Did a test here and it seems to be working pretty good:
> https://github.com/sbabic/swupdate/pull/66#issuecomment-1018018085
> 

Nice, thanks ! I have also applied a patch to fix REUSE 
(contributing.yml needs SPDX, too).

Best regards,
Stefano

>>
>> Best regards,
>> Stefano Babic
>>
>> --
>> =====================================================================
>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
>> =====================================================================
diff mbox series

Patch

diff --git a/.github/workflows/contributing.yml b/.github/workflows/contributing.yml
new file mode 100644
index 0000000..82041d1
--- /dev/null
+++ b/.github/workflows/contributing.yml
@@ -0,0 +1,29 @@ 
+on:
+  pull_request_target:
+    types:
+      - opened
+
+jobs:
+  comment:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Install pandoc
+        run: sudo apt-get install pandoc
+      - uses: actions/github-script@v5
+        with:
+          script: |
+            const contributing = await github.rest.repos.getContent({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              path: 'doc/source/contributing.rst',
+            })
+            options = {
+              input: Buffer.from(contributing.data.content, 'base64')
+            }
+            mdout = await exec.getExecOutput('pandoc', ['-f', 'rst', '-t', 'gfm'], options)
+            github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body: mdout.stdout
+            })
diff --git a/.gitignore b/.gitignore
index 2742314..e178b7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -123,3 +123,4 @@  web-app/swupdate-www.tar.gz
 
 # ci
 !.gitlab-ci.yml
+!.github