Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Github action to convert CSV to markdown

License

NotificationsYou must be signed in to change notification settings

asml-actions-validation/csv-to-md-table-action

 
 

Repository files navigation

This action prints converts a given CSV to a markdown formatted table

Inputs

csvinput

Required CSV to be converted.

Outputs

markdown-table

The markdown formatted table

Example usage

uses:petems/csv-to-md-table-action@masterwith:csvinput:|    First Name, Last Name, Address, Town, State, Zip    John,Doe,120 jefferson st.,Riverside, NJ, 08075    Jack,McGinnis,220 hobo Av.,Phila, PA,09119

You can then take the output to post comments on pull-requests for example:

on:pull_request:paths:      -'*/**.csv'jobs:build:name:Comment CSV as Pull-request Tableruns-on:ubuntu-lateststeps:      -name:Checkout Repouses:actions/checkout@master      -name:Read CSVid:csvuses:juliangruber/read-file-action@v1with:path:./people.csv      -name:Create MDuses:petems/csv-to-md-table-action@masterid:csv-table-outputwith:csvinput:${{ steps.csv.outputs.content }}      -uses:mshick/add-pr-comment@v1with:message:|            ${{steps.csv-table-output.outputs.markdown-table}}repo-token:${{ secrets.GITHUB_TOKEN }}repo-token-user-login:'github-actions[bot]'# The user.login for temporary GitHub tokensallow-repeats:true

So when you make a change to CSV file via pull-request, it makes a comment with the table:image

There's a demo of it in action here:https://github.com/petems/csv-table-comment-example

Testing

Install the dependencies

npm install

Run the tests ✔️

$ npmtest> javascript-action@1.0.0test /Users/petersouter/projects/csv-to-md-table-action> jest PASS  ./index.test.js  ✓ parses csv and converts to valid markdown table (138ms)...

Package for distribution

GitHub Actions will run the entry point from the action.yml. Packaging assembles the code into one file that can be checked in to Git, enabling fast and reliable execution and preventing the need to check in node_modules.

Actions are run from GitHub repos. Packaging the action will create a packaged action in the dist folder.

Run prepare

npm run prepare

Since the packaged index.js is run from the dist folder.

git add dist

Create a release branch

Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.

Checkin to the v1 release branch

git checkout -b v1git commit -a -m"v1 release"
git push origin v1

Note: We recommend using the--license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! 🚀

See theversioning documentation

About

A Github action to convert CSV to markdown

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp