jaywcjlove / github-action-read-file

Read file contents.
https://jaywcjlove.github.io/github-action-read-file
MIT License
7 stars 1 forks source link

Recursively read files in directory/path into JSON output #12

Open rugk opened 6 months ago

rugk commented 6 months ago

I do have a GitHub repository for a Mozilla Firefox add-on (WebExtension). It does have changelog data listed in the repository in the following structure (see live in https://github.com/rugk/mastodon-simplified-federation/tree/main/assets/texts):

$ ls -a assets/texts
.  ..  de  en  fr  pt_BR
$ cat assets/texts/en/Changelog/2.2.html 
<ul>
<li><strong>New:</strong> The translation for Dutch has been added, see <a href="https://github.com/rugk/mastodon-simplified-federation/pull/118">#118</a>.</li>
<li><strong>Fixed:</strong>: Fixed problem sometimes duplicating tabs when interacting with Mastodon instances, see <a href="https://github.com/rugk/mastodon-simplified-federation/issues/117">#117</a>.</li>
</ul>

More information <a href="https://github.com/rugk/mastodon-simplified-federation/releases/tag/v2.2">on GitHub</a>.

So for the given example, if I have a fixed version number (which is possible to find out) I want an output like this:

{
  "en": "<content of assets/texts/en/Changelogs/2.2.html>",
  "de": "<content of assets/texts/de/Changelogs/2.2.html>"
  # etc.
}

So, the structure is always the same and I want to read all the content in a GitHub action and put it into a JSON format.

It should then be passed as a changelog/release notes into the following GitHub Action:

steps:
  - uses: wdzeng/firefox-addon@v1.1.0-alpha.0
    with:
      addon-guid: your-addon's-guid
      xpi-path: your-addon.zip
      self-hosted: false
      release-notes: {"en-US":"foo"}
      jwt-issuer: ${{ secrets.FIREFOX_JWT_ISSUER }}
      jwt-secret: ${{ secrets.FIREFOX_JWT_SECRET }}

https://github.com/wdzeng/firefox-addon/issues/2#issuecomment-2040386656

Idea

A real action to read multiple files would be great and simplify stuff here.

In my case I asked ChatGPT and got a quite complicated script.

jaywcjlove commented 6 months ago

@rugk I have no intention of implementing such a requirement, and I haven't found a reason why it should be implemented.