Files
lnreader-plugins/.github/workflows/updatejson.yml
T
nyagami 6bc3900d30 feat: Github Actions to Avoid PR Conflicts (#497)
* remove .env file

* remove dotenv, move json dir

* fix: create dir if not exists

* test actions

* fix: specific branch

* test double commit

* fix: only add dist dir

* cleanup

* test push without updating json

* test actions without plugins diff

* plugins: update json files for new plugins (#7)

* test without config.json

* plugins: update json files for new plugins (#8)

* fix: ordering in Win is not the same as Linux

* plugins: update json files for new plugins (#10)

* test no update

* test: create PR if there're changes

* fix: wrong path

* test: if there're changes

* fix: wrong operator

* fix: assign boolean to github output

* plugins: update json files for new plugins (#13)

* clean up and update README

* clean up

* last cleant up xD
2023-05-16 21:09:22 +05:30

58 lines
1.4 KiB
YAML

name: Update json files
on:
push:
branches:
- plugins
jobs:
updatejson:
if: github.repository == 'LNReader/lnreader-sources'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Clean up current dist
run: |
rm -rf dist
mkdir dist
cat > config.json << EOF
{
"githubUsername": "LNReader",
"githubRepository": "lnreader-sources",
"githubBranch": "plugins"
}
EOF
- name: Update json files
id: json
run: |
node scripts/json_plugins.js
changes="$(git diff)"
if [ "$changes" ]
then
changes=1
else
changes=""
fi
echo "json-diff=$changes" >> $GITHUB_OUTPUT
- name: Create pull request
if: ${{ steps.json.outputs.json-diff }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
author: rajarsheechatterjee <rajarshee.adm@gmail.com>
committer: rajarsheechatterjee <rajarshee.adm@gmail.com>
commit-message: 'plugins: update json files for new plugins'
title: Update json files
labels: enhancement
body: Auto-generated PR for updating json files
branch: update-json
delete-branch: true