Code Monkey home page Code Monkey logo

comment-on-pr's Issues

No Licence ?

Hi ! I am willing to create a fork from your repos, but I dismissed it as soon as I saw that there is no Licence file. Could you add one ?

Is checkout step really necessary?

In your example:

    steps:
      - uses: actions/checkout@master
      - uses: harupy/comment-on-pr@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          filename: template.md

Does the step actions/checkout@master is really necessary for add a comment on a PR ?

Pipeline would be slightly faster without checkout step.

include artefacts in Comment

It would be great if it was possible to include (in particular image) artefacts in the PR comment. I could not see this feature documented though... Thanks for this...

Comment on PRs with specific label?

Hi, love the work you've done with this tool, but I was wondering if there was a way to make it add a comment only when I add a specific label to the PR, and if I could have it comment different things depending on the label that I add.

Thanks! :)

Creating the `template.md` file on the fly.

Hi, I'm looking to add an action to a private repository of mine where the word count of the main document is commented when a PR is opened.

I have two components: (1) wordcount.py (below) takes the main.tex file, summarises the word count and writes it to file at (2) .github/workflows/wordcount.md.

# wordcount.py
import os
import subprocess

def main():
    """ Save the output of texcount to file and then trim it. """

    with open(".github/workflows/wordcount.md", "w") as f:
        f.write("The current word count is:\n")
        f.write("==========================\n\n")

        cmd = "texcount -inc -nosub main.tex"
        string = str(subprocess.check_output(cmd, shell=True))
        items = string.split("\\n\\n")
        block = items[-2]

        for line in block.split("\\n")[2:]:
            f.write(line + "\n")


if __name__ == "__main__":
    main()

My action file .github/workflows/wordcount.yml looks like this then:

name: Comment word count

on: pull_request

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        python-version: [3.7]

    steps:
      - uses: actions/checkout@v1
      - name: Setup Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install LaTeX
        run: |
            sudo apt-get update
            sudo apt-get install -y texlive-extra-utils
      - name: Clone submodules
        run: git submodule update --init --recursive
      - name: Calculate wordcount
        run: python wordcount.py
      - name: Comment word count
        uses: harupy/comment-on-pr@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          template: wordcount.md

However, when the action runs on GitHub I get the error below and I have no idea why. Would you be able to shed some light on this at all?

 with:
    template: wordcount.md
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.7.6/x64
    GITHUB_TOKEN: ************
/usr/bin/docker run --name f64d7289f5ffc4be04e629a4bd1a214c5ca80_982401 \
 --label 1f64d7 --workdir /github/workspace --rm -e pythonLocation -e GITHUB_TOKEN \ 
-e INPUT_TEMPLATE -e INPUT_DOMAIN -e HOME -e GITHUB_REF -e GITHUB_SHA \
-e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR \
-e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF \
-e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION \
-e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP \
-e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN \
-e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" \
-v "/home/runner/work/_temp/_github_home":"/github/home" \
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
-v "/home/runner/work/thesis/thesis":"/github/workspace" 1f64d7:289f5ffc4be04e629a4bd1a214c5ca80
python: can't open file 'entrypoint.py': [Errno 2] No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.