Skip to content

[NEW PROJECT]: Improve quality metrics implementation and add to decoder #15

[NEW PROJECT]: Improve quality metrics implementation and add to decoder

[NEW PROJECT]: Improve quality metrics implementation and add to decoder #15

Workflow file for this run

name: New Project from Issue
on:
issues:
types: [opened, edited, reopened]
jobs:
new-project-from-issue:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check issue
id: check-issue
run: |
if [[ "${{ github.event.issue.title }}" == "[NEW PROJECT]:"* ]]; then
title="${{ github.event.issue.title }}"
# create a variable project_name and remove the [NEW PROJECT]: from the title
project_name=${title:15}
echo "PROJECT_NAME=$project_name" >> $GITHUB_OUTPUT
project_name=${project_name// /_} # replace spaces with underscores
# make all lower cases
project_name=$(echo $project_name | tr '[:upper:]' '[:lower:]')
# check if the projects folder doesn't exist and create it if needed
if [ ! -d projects ]; then
mkdir projects
fi
if [ ! -d projects/$project_name ]; then
echo "Project does not exist: creating folder"
mkdir projects/$project_name
fi
echo "PR_NEEDED=true" >> $GITHUB_OUTPUT
echo "PROJECT_NAME=$project_name" >> $GITHUB_OUTPUT
# creadte a new file with the project name.md and the issue body as content
echo "${{ github.event.issue.body }}" > projects/$project_name/README.md
mkdir projects/$project_name/src
echo "Add your code here" > projects/$project_name/src/README.md
else
echo "PR not needed"
echo "PR_NEEDED=false" >> $GITHUB_OUTPUT
fi
- name: Create PR
uses: peter-evans/create-pull-request@v5
if : ${{ steps.check-issue.outputs.PR_NEEDED == 'true' }}
with:
commit-message: adding new project
title: "Add ${{ steps.check-issue.outputs.PROJECT_NAME }} to projects folder"
body: "Add project to the projects folder. Fixes #${{ github.event.issue.number }}"
branch: new-project-issue-${{ github.event.issue.number }}