Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reading body from a file #115

Merged
merged 5 commits into from Oct 24, 2022
Merged

Conversation

umanghome
Copy link
Contributor

Ran into an issue where the body stored in the environment variable was throwing an error saying Error: Argument list too long (similar to #96).

Added support for file and fileEncoding arguments which can be passed in order to allow accessing the body directly from files, bypassing the need to store the body as a variable and escaping it. This also removes the restriction of the body content being too long to be supported by sh.

@daulet
Copy link

daulet commented Aug 10, 2022

PTAL @peter-evans

@AtzeDeVries
Copy link

AtzeDeVries commented Oct 17, 2022

@peter-evans this would really help if this get merged/reviewed. Thnx!

@umanghome can you maybe sync your branch again? Then we can make use of the fork for now until this is merged (or not) Thnx!

@peter-evans
Copy link
Owner

peter-evans commented Oct 17, 2022

@umanghome Thank you for contributing this. Apologies for not looking at it sooner.

This issue comes up occasionally for a few of the actions I maintain. I was really trying to avoid adding this feature to read input from files for a few reasons:

  1. I wanted to keep the action interfaces simple
  2. I didn't want to open up the actions to a wave of new feature requests around file IO, such as templating.
  3. This is really a runner environment limitation that we are having to work around. It just feels broken/wrong to have to do this.

However, I don't see any sign that this will be fixed at an environment level, so I'm considering merging this.

@AtzeDeVries
Copy link

Thnx for the reply. Just a note that if you use the file based method and have multiline comments you don't require this

body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}" 

To make multiline work.

But i agree that with your reasoning but i sadly also don't see that the env limitation with be fixed anytime soon.

@peter-evans
Copy link
Owner

@umanghome, (and anyone else following this issue), do you need the input fileEncoding to specify something other than utf8? I'm wondering if you just added that as a "just in case someone finds this useful" feature.

If nobody needs it then I will omit it until there is a need.

@umanghome
Copy link
Contributor Author

umanghome commented Oct 21, 2022

@peter-evans fileEncoding is definitely a "just in case someone finds this useful" feature.

I can remove it from the changes in this branch if you'd like.

@peter-evans
Copy link
Owner

@umanghome Got it. Thanks for confirming.

I'm going to merge this to a feature branch so I can make some tweaks and add a test. Then I'll merge it into main with your contributions.

@peter-evans peter-evans changed the base branch from main to body-file October 24, 2022 05:47
@peter-evans peter-evans merged commit b9257b6 into peter-evans:body-file Oct 24, 2022
@peter-evans peter-evans mentioned this pull request Oct 24, 2022
@peter-evans
Copy link
Owner

Released as v2.1.0 / v2. Note that I decided to change the input name from file to body-file to make it a little more specific.

Thank you @umanghome

Brooooooklyn pushed a commit to rolldown/rolldown that referenced this pull request Mar 9, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [peter-evans/create-or-update-comment](https://togithub.com/peter-evans/create-or-update-comment) | action | major | `v1.4.5` -> `v4.0.0` |

---

### Release Notes

<details>
<summary>peter-evans/create-or-update-comment (peter-evans/create-or-update-comment)</summary>

### [`v4.0.0`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v4.0.0): Create or Update Comment v4.0.0

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v3.1.0...v4.0.0)

⚙️  Updated runtime to Node.js 20

-   The action now requires a minimum version of [v2.308.0](https://togithub.com/actions/runner/releases/tag/v2.308.0) for the Actions runner. Update self-hosted runners to v2.308.0 or later to ensure compatibility.

#### What's Changed

-   build(deps): bump actions/setup-node from 3 to 4 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#273
-   build(deps-dev): bump [@&#8203;vercel/ncc](https://togithub.com/vercel/ncc) from 0.38.0 to 0.38.1 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#274
-   build(deps-dev): bump eslint-plugin-jest from 27.4.2 to 27.4.3 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#276
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.5 to 18.18.6 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#277
-   build(deps-dev): bump eslint from 8.51.0 to 8.52.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#275
-   build(deps-dev): bump eslint-plugin-jest from 27.4.3 to 27.6.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#278
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.6 to 18.18.8 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#279
-   build(deps-dev): bump eslint from 8.52.0 to 8.53.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#280
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.8 to 18.18.9 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#281
-   build(deps-dev): bump prettier from 3.0.3 to 3.1.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#282
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.9 to 18.18.12 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#283
-   build(deps-dev): bump eslint from 8.53.0 to 8.54.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#284
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.12 to 18.18.13 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#285
-   build(deps-dev): bump eslint from 8.54.0 to 8.55.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#286
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.18.13 to 18.19.2 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#287
-   build(deps): bump chuhlomin/render-template from 1.8 to 1.9 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#288
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.19.2 to 18.19.3 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#289
-   build(deps-dev): bump prettier from 3.1.0 to 3.1.1 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#290
-   build(deps-dev): bump eslint-plugin-prettier from 5.0.1 to 5.1.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#292
-   build(deps-dev): bump eslint from 8.55.0 to 8.56.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#293
-   build(deps): bump actions/download-artifact from 3 to 4 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#295
-   build(deps-dev): bump eslint-plugin-prettier from 5.1.0 to 5.1.2 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#296
-   build(deps-dev): bump eslint-plugin-jest from 27.6.0 to 27.6.1 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#297
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.19.3 to 18.19.4 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#298
-   build(deps-dev): bump eslint-plugin-prettier from 5.1.2 to 5.1.3 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#299
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.19.4 to 18.19.6 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#300
-   build(deps-dev): bump prettier from 3.1.1 to 3.2.3 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#301
-   build(deps-dev): bump eslint-plugin-jest from 27.6.1 to 27.6.3 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#302
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.19.6 to 18.19.7 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#303
-   build(deps-dev): bump [@&#8203;types/node](https://togithub.com/types/node) from 18.19.7 to 18.19.8 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#304
-   build(deps-dev): bump prettier from 3.2.3 to 3.2.4 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#305
-   feat: update runtime to node 20 by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#306

**Full Changelog**: peter-evans/create-or-update-comment@v3.1.0...v4.0.0

### [`v3.1.0`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v3.1.0): Create or Update Comment v3.1.0

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v3.0.2...v3.1.0)

#### What's Changed

-   Add truncate warning to body of comment by [@&#8203;ethanmdavidson](https://togithub.com/ethanmdavidson) and [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#272
-   46 dependency updates by [@&#8203;dependabot](https://togithub.com/dependabot)

**Full Changelog**: peter-evans/create-or-update-comment@v3.0.2...v3.1.0

### [`v3.0.2`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v3.0.2): Create or Update Comment v3.0.2

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v3.0.1...v3.0.2)

#### What's Changed

-   Truncate long comment bodies during comment update too by [@&#8203;Dermah](https://togithub.com/Dermah) in [peter-evans/create-or-update-comment#205
-   Update distribution by [@&#8203;actions-bot](https://togithub.com/actions-bot) in [peter-evans/create-or-update-comment#210
-   23 dependency updates by [@&#8203;dependabot](https://togithub.com/dependabot)

#### New Contributors

-   [@&#8203;Dermah](https://togithub.com/Dermah) made their first contribution in [peter-evans/create-or-update-comment#205

**Full Changelog**: peter-evans/create-or-update-comment@v3.0.1...v3.0.2

### [`v3.0.1`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v3.0.1): Create or Update Comment v3.0.1

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v3.0.0...v3.0.1)

#### What's Changed

-   fix: find-comment version by [@&#8203;ematipico](https://togithub.com/ematipico) in [peter-evans/create-or-update-comment#164
-   fix: truncate body when it exceeds the max length by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#182
-   12 dependency updates by [@&#8203;dependabot](https://togithub.com/dependabot)

#### New Contributors

-   [@&#8203;ematipico](https://togithub.com/ematipico) made their first contribution in [peter-evans/create-or-update-comment#164

**Full Changelog**: peter-evans/create-or-update-comment@v3.0.0...v3.0.1

### [`v3.0.0`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v3.0.0): Create or Update Comment v3.0.0

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v2.1.1...v3.0.0)

#### What's new

-   Now supports replacing reactions on a comment by setting input `reactions-edit-mode` to `replace`. The default behaviour has not changed and will `append` reactions.
-   Chose how the action should append the comment body with input `append-separator`. The default behaviour is to add a `newline`. Other options are `space` and `none`.
-   `body-file` is deprecated in favour of `body-path`. The behaviour is unchanged.

#### What's Changed

-   v3 by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#161
-   Update some links in the README by [@&#8203;Kurt-von-Laven](https://togithub.com/Kurt-von-Laven) in [peter-evans/create-or-update-comment#152
-   9 dependency updates by [@&#8203;dependabot](https://togithub.com/dependabot)

#### New Contributors

-   [@&#8203;Kurt-von-Laven](https://togithub.com/Kurt-von-Laven) made their first contribution in [peter-evans/create-or-update-comment#152

**Full Changelog**: peter-evans/create-or-update-comment@v2.1.1...v3.0.0

### [`v2.1.1`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v2.1.1): Create or Update Comment v2.1.1

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v2.1.0...v2.1.1)

⚙️ Fixes the recent Json5 vulnerability.

#### What's Changed

-   11 dependency updates by [@&#8203;dependabot](https://togithub.com/dependabot)

**Full Changelog**: peter-evans/create-or-update-comment@v2.1.0...v2.1.1

### [`v2.1.0`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v2.1.0): Create or Update Comment v2.1.0

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v2.0.1...v2.1.0)

⭐ Adds input `body-file`, the path to a file containing the comment body.

#### What's Changed

-   Replace set-output by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#130
-   Bump chuhlomin/render-template from 1.5 to 1.6 by [@&#8203;dependabot](https://togithub.com/dependabot) in [peter-evans/create-or-update-comment#132
-   Support reading body from a file by [@&#8203;umanghome](https://togithub.com/umanghome) in [peter-evans/create-or-update-comment#115
-   Add input body-file by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#133

#### New Contributors

-   [@&#8203;umanghome](https://togithub.com/umanghome) made their first contribution in [peter-evans/create-or-update-comment#115

**Full Changelog**: peter-evans/create-or-update-comment@v2.0.1...v2.1.0

### [`v2.0.1`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v2.0.1): Create or Update Comment v2.0.1

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v2.0.0...v2.0.1)

⚙️ Bumps `@actions/core` to transition away from [deprecated runner commands](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/).

#### What's Changed

-   Add workflow permissions by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#120
-   9 dependency updates by [@&#8203;github-actions](https://togithub.com/github-actions) and https://github.com/dependabot

**Full Changelog**: peter-evans/create-or-update-comment@v2.0.0...v2.0.1

### [`v2.0.0`](https://togithub.com/peter-evans/create-or-update-comment/releases/tag/v2.0.0): Create or Update Comment v2.0.0

[Compare Source](https://togithub.com/peter-evans/create-or-update-comment/compare/v1.4.5...v2.0.0)

#### What's new

-   Updated runtime to Node.js 16
    -   The action now requires a minimum version of v2.285.0 for the [Actions Runner](https://togithub.com/actions/runner/releases/tag/v2.285.0).
    -   If using GitHub Enterprise Server, the action requires [GHES 3.4](https://docs.github.com/en/enterprise-server@3.4/admin/release-notes) or later.

#### What's Changed

-   Use double quotes to preserve adjacent spaces correctly by [@&#8203;mfn](https://togithub.com/mfn) in [peter-evans/create-or-update-comment#95
-   Remove workflow by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#101
-   Update runtime to node 16 by [@&#8203;peter-evans](https://togithub.com/peter-evans) in [peter-evans/create-or-update-comment#105
-   7 dependency updates by [@&#8203;actions-bot](https://togithub.com/actions-bot) and [@&#8203;dependabot](https://togithub.com/dependabot)

#### New Contributors

-   [@&#8203;mfn](https://togithub.com/mfn) made their first contribution in [peter-evans/create-or-update-comment#95

**Full Changelog**: peter-evans/create-or-update-comment@v1.4.5...v2.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rolldown-rs/rolldown).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIzMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants