- Notifications
You must be signed in to change notification settings - Fork0
A Github action to convert CSV to markdown
License
asml-actions-validation/csv-to-md-table-action
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This action prints converts a given CSV to a markdown formatted table
Required CSV to be converted.
The markdown formatted table
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:
There's a demo of it in action here:https://github.com/petems/csv-table-comment-example
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)...
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
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- JavaScript100.0%