Skip to content

[PluginUpdate]: BtnCmd 01.03.03 #299

[PluginUpdate]: BtnCmd 01.03.03

[PluginUpdate]: BtnCmd 01.03.03 #299

Workflow file for this run

name: remove-plugin
on:
issues:
types: [opened]
jobs:
issue_label_check:
runs-on: ubuntu-latest
outputs:
is_check_ok: ${{ steps.label_check.outputs.is_check_ok }}
steps:
- uses: actions/checkout@v2
- name: label-check
id: label_check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
issue_label=$(curl https://api.github.com/repos/Duet3D/PluginRepository/issues/${{ github.event.issue.number }}/labels | jq -r .[0]."name")
if [[ "$issue_label" = plugin-removal ]]; then echo ::set-output name=is_check_ok::'success'; else echo ::set-output name=is_check_ok::'failure'; fi
removal-precheck:
needs: issue_label_check
if: ${{ needs.issue_label_check.outputs.is_check_ok == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: stefanbuck/github-issue-praser@v2
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/PluginRemoval.yml
- run: echo '${{ steps.issue-parser.outputs.jsonString }}' > issue.json
- name: Remove plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ISSUE: ${{github.event.issue.number}}
GITHUB_USER: ${{ github.event.issue.user.login }}
PAT_DUET3D_ADMIN_ORG_READ: ${{ secrets.PAT_DUET3D_ADMIN_ORG_READ }}
run: |
set -e
cat issue.json
cp issue.json nodescriptsTS/src/
cd nodescriptsTS
npm install
cd src
npx ts-node removalPrecheck.ts
plugin-removal:
needs: removal-precheck
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v2
- uses: geertvdc/setup-hub@master
- uses: stefanbuck/github-issue-praser@v2
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/PluginSubmission.yml
- run: echo '${{ steps.issue-parser.outputs.jsonString }}' > issue.json
- name: Remove plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ISSUE: ${{github.event.issue.number}}
GITHUB_USER: ${{ github.event.issue.user.login }}
run: |
set -e
plugin=$(cat issue.json | jq -r ."plugin_id")
plugin_file=src/plugins/"$plugin".md
plugin_version_file=plugin_versions/"$plugin".json
branchName=removal/$(date +"%y%m%d")$plugin
commituser=Duet3D
rm $plugin_file
rm $plugin_version_file
git config --global user.name "yasasw"
git config --global user.email "yasas.wijetilake@gmail.com"
git checkout -b $branchName
git add $plugin_file $plugin_version_file
git commit -m "Deleting plugin plugin_file and plugin_version_file"
git push -u origin $branchName
hub pull-request -m "[${{ github.event.issue.number }}]-$branchName" -l plugin-removal --base $commituser:master --head $commituser:$branchName
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" https://api.github.com/repos/Duet3D/PluginRepository/issues/${{ github.event.issue.number }}/labels -d '{"labels":["ready-for-approval"]}'