-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate podcasts with an issue form
- Loading branch information
1 parent
cde8797
commit 124d785
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: New podcast | ||
description: submit a new podcast for angular-hub.com/podcasts | ||
title: '[New podcast]: ' | ||
body: | ||
- type: input | ||
id: name | ||
attributes: | ||
label: Podcast name | ||
validations: | ||
required: true | ||
- type: input | ||
id: url | ||
attributes: | ||
label: Podcast URL | ||
description: Choose the preferred platform to share the podcast content | ||
validations: | ||
required: true | ||
- type: input | ||
id: logo | ||
attributes: | ||
label: Podcast logo | ||
- type: input | ||
id: language | ||
attributes: | ||
label: Language | ||
validations: | ||
required: true | ||
- type: markdown | ||
attributes: | ||
value: >- | ||
This template was generated with [Issue Forms | ||
Creator](https://issue-forms-creator.netlify.app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Add podcast | ||
on: | ||
issues: | ||
types: | ||
- labeled | ||
concurrency: 'main' | ||
jobs: | ||
add_podcast: | ||
if: github.event.label.name == 'podcast-approved' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- uses: stefanbuck/github-issue-praser@v3 | ||
id: issue-parser | ||
with: | ||
template-path: .github/ISSUE_TEMPLATE/add-podcast.yml | ||
|
||
- run: echo '${{ steps.issue-parser.outputs.jsonString }}' > add-podcast.json | ||
|
||
- run: cat add-podcast.json | ||
|
||
- run: node ./scripts/add-podcast.js | ||
|
||
- name: Commit changes | ||
shell: bash | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" && \ | ||
git config --global user.name "github-actions[bot]" && \ | ||
git add README.md && \ | ||
git commit -m 'Add podcast' && \ | ||
git push | ||
- uses: peter-evans/close-issue@v1 | ||
with: | ||
comment: 'Podcast added: thanks for your contribution!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const fs = require('fs'); | ||
const order = require('./../add-podcast.json'); | ||
|
||
const [name, url, logo, language] = Object.values(order); | ||
|
||
let podcastRaw = fs.readFileSync( | ||
'./angular-hub/src/public/assets/data/podcast.json', | ||
); | ||
let podcastData = JSON.parse(podcastRaw); | ||
let json = JSON.stringify( | ||
[ | ||
...podcastData, | ||
{ | ||
name, | ||
url, | ||
logo, | ||
language, | ||
}, | ||
], | ||
null, | ||
2, | ||
); | ||
|
||
fs.writeFileSync('./angular-hub/src/public/assets/data/podcast.json', json); |