-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle new scale request issues automatically
- Loading branch information
Showing
3 changed files
with
92 additions
and
2 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
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,82 @@ | ||
name: Handle new scale issue | ||
|
||
on: | ||
issues: | ||
types: [opened, edited] | ||
|
||
jobs: | ||
process-issue: | ||
if: contains(github.event.issue.body, 'new-scale-request-template') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Issue ID | ||
id: issue_id | ||
run: echo "::set-output name=id::${{ github.event.issue.number }}" | ||
|
||
- name: Parse issue body and extract fields | ||
id: parse_fields | ||
run: | | ||
CONTAINER_FORM=$(grep -oP '(?<=containerForm\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
LENGTH_UNIT=$(grep -oP '(?<=lengthUnit\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
VOLUME_UNIT=$(grep -oP '(?<=volumeUnit\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
DIAMETER=$(grep -oP '(?<=diameter\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
HEIGHT=$(grep -oP '(?<=height\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
MIN_VOLUME=$(grep -oP '(?<=minimumVolume\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
MAX_VOLUME=$(grep -oP '(?<=maximumVolume\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
DESCRIPTION=$(grep -oP '(?<=description\n)[^\n]+' issue_body.txt | tr -d '\r') | ||
FILENAME="${CONTAINER_FORM}_${LENGTH_UNIT}_d${DIAMETER}_h${HEIGHT}_${MIN_VOLUME}-${MAX_VOLUME}${VOLUME_UNIT}_i1" | ||
echo "Form: $CONTAINER_FORM" | ||
echo "LenghtUnit: $LENGTH_UNIT" | ||
echo "VolumeUnit: $VOLUME_UNIT" | ||
echo "Diameter: $DIAMETER" | ||
echo "Height: $HEIGHT" | ||
echo "MinVolume: $MIN_VOLUME" | ||
echo "MaxVolume: $MAX_VOLUME" | ||
echo "Description: $DESCRIPTION" | ||
echo "FileName: $FILENAME" | ||
echo "::set-output name=container_form::$CONTAINER_FORM" | ||
echo "::set-output name=length_unit::$LENGTH_UNIT" | ||
echo "::set-output name=volume_unit::$VOLUME_UNIT" | ||
echo "::set-output name=diameter::$DIAMETER" | ||
echo "::set-output name=height::$HEIGHT" | ||
echo "::set-output name=min_volume::$MIN_VOLUME" | ||
echo "::set-output name=max_volume::$MAX_VOLUME" | ||
echo "::set-output name=description::$DESCRIPTION" | ||
echo "::set-output name=filename::$FILENAME" | ||
- name: Create or override scale file. | ||
run: | | ||
newFile="./scales/definitions/${{ steps.parse_fields.outputs.filename }}.json" | ||
cp -f ./scales/definitions/_newscale.json.template "$newFile" | ||
./scales/definitions/_apply_filename_to_json.sh "$newFile" | ||
- name: Generate scale svg | ||
|
||
- name: Configure git | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
- name: Create new branch and commit changes | ||
run: | | ||
BRANCH_NAME="feature/scale-request-${{ steps.issue_id.outputs.id }}" | ||
git checkout -b $BRANCH_NAME | ||
git add . | ||
git commit -m "Add/Edit scale for scale request #${{ steps.issue_id.outputs.id }}" | ||
#git push origin $BRANCH_NAME | ||
# - name: Create pull request | ||
# id: create_pr | ||
# uses: peter-evans/create-pull-request@v5 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# head: ${{ github.repository }}:feature/${{ steps.issue_id.outputs.id }} | ||
# base: main | ||
# title: "Scale Request #${{ steps.issue_id.outputs.id }}" | ||
# body: "This PR is to handle the scale request from issue #${{ steps.issue_id.outputs.id }}" |
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