chuhlomin / render-template

GitHub Action to render file based on template and passed variables
Apache License 2.0
27 stars 12 forks source link

template file not found #6

Closed lucasff closed 11 months ago

lucasff commented 2 years ago

Hello, I would appreciate a lot some support. With the following

with:
  template: .github/comment-template-preview-env.md

failed to render template: template file not found (".github/comment-template-preview-env.md")

I get the error the file is not found. I'm assuming this is due to the file not being available in your container? Can you help me figure out how GH Actions is supposed to work, or maybe improve the documentation with some necessary code that I'm missing?

Thank you in advance

chuhlomin commented 2 years ago

Hi, do you have this step in your workflow?

      - name: Checkout
        uses: actions/checkout@v2

For some reason GitHub Actions does not checkout repository by default. Here is a demonstration: https://github.com/chuhlomin/ip/runs/6619964775 for workflow https://github.com/chuhlomin/ip/blob/workflow-test/.github/workflows/pull_request.yml

a-cesari commented 1 year ago

Hi @chuhlomin , I have the same problem. I'm using last version (v1.7). I created the following template file mail-not-found-template.md at this folder inside my repository: templates\mail-not-found-template.md

Dear {{ .user }},

we couldn't find the mail address in you Github profile.
Please follow these steps to set it, then **follow again the same procedure**.

- Click on your profile picture/avatar in the top right of the screen
- Click on `Your Profile`
- On the left, click on `Edit Profile`
- In the left side, from the dropdown menu close to the mail icon :email:, choose your email address 

However I get the file not found error when rendering the template. I have the checkout step in my workflow, as you can see that the file is there if I list the GITHUB_WORKSPACE folder.

Capture

And this is the error in the rendering steps:

Capture2

Thanks a lor for your kind help. Andrea

chuhlomin commented 1 year ago

Hey @a-cesari, this error is a bit different: failed to open result file "": open : no such file or directory. It is related to how action sets output values. GitHub Actions should automatically pass the GITHUB_OUTPUT environment variable with a path to the file where the action can write output values. Unfortunately, it looks like it didn't in your case. Are you running your actions on a self-hosted runner? If so, perhaps, if should be updated.

a-cesari commented 1 year ago

Yes, I'm on self hosted runners, however I installed it last week so it should be quite recent versions. I'm running actions-runner-linux-x64-2.296.3.tar.gz, which is quite recent but I will anyway try to update to the latest v2.304.0 and give you a feedback. Indeed I also tried to setup the result_path but without success.

a-cesari commented 1 year ago

I confirm that the action is working properly with the latest github runner (v2.304.0)

Il giorno gio 18 mag 2023 alle 18:14 Konstantin Chukhlomin < @.***> ha scritto:

Hey @a-cesari https://github.com/a-cesari, this error is a bit different: failed to open result file "": open : no such file or directory . It is related to how action sets output values. GitHub Actions should automatically pass the GITHUB_OUTPUT environment variable with a path to the file where the action can write output values. Unfortunately, it looks like it didn't in your case. Are you running your actions on a self-hosted runner? If so, perhaps, if should be updated.

— Reply to this email directly, view it on GitHub https://github.com/chuhlomin/render-template/issues/6#issuecomment-1553292416, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQFAZX4RKFA2JYN6JDJGU3XGZDGTANCNFSM5W4LRHQQ . You are receiving this because you were mentioned.Message ID: @.***>