From 02e07383c203d134150300881edc7a638c8b65bd Mon Sep 17 00:00:00 2001 From: KalpanaReddyC Date: Thu, 7 Sep 2023 19:50:25 +0530 Subject: [PATCH] writing data to yaml file --- .github/repos/repo-settings.yml | 0 .github/workflows/issue-forms-body-parser.yml | 9 +++++++++ json-to-yaml.js | 15 +++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 .github/repos/repo-settings.yml create mode 100644 json-to-yaml.js diff --git a/.github/repos/repo-settings.yml b/.github/repos/repo-settings.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/issue-forms-body-parser.yml b/.github/workflows/issue-forms-body-parser.yml index bfb7711..1b4c088 100644 --- a/.github/workflows/issue-forms-body-parser.yml +++ b/.github/workflows/issue-forms-body-parser.yml @@ -26,11 +26,20 @@ jobs: run: | git config user.name "GitHub Actions" git config user.email noreply@github.com + + - name: Install dependencies + run: npm install js-yaml + + - name: Convert JSON to YAML + run: | + node json-to-yaml.js + cat yaml-data.yml - name: Create and Push New Branch run: | git checkout -b test-branch git add extracted-data.json + git add yaml-data.yml git commit -m "Add extracted-data.json" git push --set-upstream origin test-branch env: diff --git a/json-to-yaml.js b/json-to-yaml.js new file mode 100644 index 0000000..f15e3c2 --- /dev/null +++ b/json-to-yaml.js @@ -0,0 +1,15 @@ +const yaml = require('js-yaml'); +const fs = require('fs'); + + +const jsonData = { + "name": "first-repo", + "has_wiki": true, + "has_projects": true, + "has_issues": false +}; + +const yamlData = yaml.dump(jsonData); + +// Write the extracted data to a yaml file +fs.writeFileSync('yaml-data.yml', yamlData);