From 51766605dce44a3848a6a9cce912a0c519b15ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:05:05 +0100 Subject: [PATCH 01/42] Create issue-to-pr.yml template --- .github/workflows/issue-to-pr.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/issue-to-pr.yml diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml new file mode 100644 index 0000000..d776c2e --- /dev/null +++ b/.github/workflows/issue-to-pr.yml @@ -0,0 +1,49 @@ +name: Issue to PR Automation + +on: + issues: + types: [opened] + filters: + labels: + - 'prompt' + +jobs: + create_pr: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up Git Config + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Create Branch + id: branch_name + run: | + BRANCH_NAME="issue-${{ github.event.issue.number }}" + echo "::set-output name=branch::$BRANCH_NAME" + git checkout -b $BRANCH_NAME + + - name: Create File from Issue + run: | + echo "${{ github.event.issue.body }}" > issue-${{ github.event.issue.number }}.md + git add . + git commit -m "Add issue content for #${{ github.event.issue.number }}" + + - name: Push Branch + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push origin HEAD + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.branch_name.outputs.branch }} + title: "PR for Issue #${{ github.event.issue.number }}" + body: | + This pull request addresses Issue #${{ github.event.issue.number }}. + Automatically generated by GitHub Actions. From ac2a4fcfc5efa8c875bc3f5bafcf6094a47d1e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:20:35 +0100 Subject: [PATCH 02/42] Create 40_prompt.yml --- .github/ISSUE_TEMPLATE/40_prompt.yml | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/40_prompt.yml diff --git a/.github/ISSUE_TEMPLATE/40_prompt.yml b/.github/ISSUE_TEMPLATE/40_prompt.yml new file mode 100644 index 0000000..b539358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/40_prompt.yml @@ -0,0 +1,55 @@ +--- +name: Prompt for AIDA Marketplace +description: Template for generating a prompt in the AIDA Marketplace. +title: "{{ title }}" +labels: [prompt] +assignees: [] + +body: + - type: input + id: title + attributes: + label: Issue Title + description: Provide the title of the prompt. + placeholder: "Employee survey analysis on [TOPIC]" + validations: + required: true + + - type: input + id: author + attributes: + label: Author + description: Enter your name. + placeholder: "John Doe" + validations: + required: true + + - type: input + id: tags + attributes: + label: Tags + description: Provide relevant tags (comma-separated). + placeholder: "data, analysis, HR, backend, writing" + validations: + required: true + + - type: textarea + id: prompt + attributes: + label: Prompt + description: The raw prompt + placeholder: "Raw prompt text" + render: yaml # This will render it in a code block. + validations: + required: true + + - type: markdown + attributes: + value: | + --- + title: "{{ title }}" + author: "{{ author }}" + tags: [{{ tags }}] + --- + + {{ prompt }} From ca442a1c65647de2bbfc49902a19f93ede357958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:21:53 +0100 Subject: [PATCH 03/42] Update and rename 40_prompt.yml to 00_prompt.yml --- .github/ISSUE_TEMPLATE/{40_prompt.yml => 00_prompt.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/ISSUE_TEMPLATE/{40_prompt.yml => 00_prompt.yml} (96%) diff --git a/.github/ISSUE_TEMPLATE/40_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml similarity index 96% rename from .github/ISSUE_TEMPLATE/40_prompt.yml rename to .github/ISSUE_TEMPLATE/00_prompt.yml index b539358..e430f08 100644 --- a/.github/ISSUE_TEMPLATE/40_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,5 +1,5 @@ --- -name: Prompt for AIDA Marketplace +name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. title: "{{ title }}" labels: [prompt] From e604d1daffa1eab9f2ec156d08a44bd7c7064db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:30:19 +0100 Subject: [PATCH 04/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index d776c2e..0e0df33 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -28,7 +28,7 @@ jobs: - name: Create File from Issue run: | - echo "${{ github.event.issue.body }}" > issue-${{ github.event.issue.number }}.md + echo '${{ toJson(github.event.issue.body) }}' | jq -r '.' > "issue-${{ github.event.issue.number }}.md" git add . git commit -m "Add issue content for #${{ github.event.issue.number }}" From a1fdffbc74f73a9f305af60cbcb34b68f0ae8cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:30:44 +0100 Subject: [PATCH 05/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 0e0df33..f0ba5c0 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -3,9 +3,8 @@ name: Issue to PR Automation on: issues: types: [opened] - filters: - labels: - - 'prompt' + labels: + - 'prompt' jobs: create_pr: @@ -33,8 +32,6 @@ jobs: git commit -m "Add issue content for #${{ github.event.issue.number }}" - name: Push Branch - env: - TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git push origin HEAD From 7bc3b76195df2b383a0230982c65d33602a20a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:35:40 +0100 Subject: [PATCH 06/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index f0ba5c0..4161304 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -8,6 +8,7 @@ on: jobs: create_pr: + if: contains( toJson( github.event.issue.labels ), '"prompt"' ) runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -22,9 +23,13 @@ jobs: id: branch_name run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" - echo "::set-output name=branch::$BRANCH_NAME" + echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT git checkout -b $BRANCH_NAME + - name: Debug Branch Name + run: | + echo "Branch name is: ${{ steps.branch_name.outputs.branch }}" + - name: Create File from Issue run: | echo '${{ toJson(github.event.issue.body) }}' | jq -r '.' > "issue-${{ github.event.issue.number }}.md" @@ -40,7 +45,11 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} + base: main # Ensure this is the correct base branch title: "PR for Issue #${{ github.event.issue.number }}" body: | This pull request addresses Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. + body: | + This pull request addresses Issue #${{ github.event.issue.number }}. + Automatically generated by GitHub Actions. From ed039782fdb7c58d5f369b615fd27bf4bd28961a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:39:06 +0100 Subject: [PATCH 07/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 4161304..420a9ed 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -3,8 +3,6 @@ name: Issue to PR Automation on: issues: types: [opened] - labels: - - 'prompt' jobs: create_pr: @@ -50,6 +48,3 @@ jobs: body: | This pull request addresses Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. - body: | - This pull request addresses Issue #${{ github.event.issue.number }}. - Automatically generated by GitHub Actions. From d4aa56bcec9bde12352cb5b60872b6ff046599b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:41:59 +0100 Subject: [PATCH 08/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index e430f08..03965ef 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,20 +1,11 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. -title: "{{ title }}" labels: [prompt] assignees: [] body: - - type: input - id: title - attributes: - label: Issue Title - description: Provide the title of the prompt. - placeholder: "Employee survey analysis on [TOPIC]" - validations: - required: true - + # Removed the 'title' input field - type: input id: author attributes: @@ -47,7 +38,7 @@ body: attributes: value: | --- - title: "{{ title }}" + title: "{{ ISSUE_TITLE }}" author: "{{ author }}" tags: [{{ tags }}] --- From a53ae21d52a4049b7931fe1074b365dfd9630d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:50:24 +0100 Subject: [PATCH 09/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index 03965ef..fbb60f4 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,11 +1,20 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. +title: "{{ prompt_name }}" labels: [prompt] assignees: [] body: - # Removed the 'title' input field + - type: input + id: prompt_name + attributes: + label: Prompt Name + description: Enter the prompt name (used for file naming). + placeholder: "Diversity inclusion text enhancer" + validations: + required: true + - type: input id: author attributes: @@ -20,7 +29,7 @@ body: attributes: label: Tags description: Provide relevant tags (comma-separated). - placeholder: "data, analysis, HR, backend, writing" + placeholder: "diversity, text, enhancer" validations: required: true @@ -28,8 +37,17 @@ body: id: prompt attributes: label: Prompt - description: The raw prompt - placeholder: "Raw prompt text" + description: The raw prompt text. + placeholder: | + Given a text, enhance it to be more inclusive and diverse. + - Do not use offensive words or phrases. + - Do not use words or phrases that are not inclusive or diverse. + - Do it in a way that it sounds natural and not forced. + Text to enhance: + + \`\`\` + [TEXT] + \`\`\` render: yaml # This will render it in a code block. validations: required: true @@ -38,7 +56,7 @@ body: attributes: value: | --- - title: "{{ ISSUE_TITLE }}" + title: "{{ prompt_name }}" author: "{{ author }}" tags: [{{ tags }}] --- From ed16691414b05dd616ddecbc7a6057b8472b0599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:52:21 +0100 Subject: [PATCH 10/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 60 +++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 420a9ed..22376b0 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -3,6 +3,8 @@ name: Issue to PR Automation on: issues: types: [opened] + labels: + - 'prompt' jobs: create_pr: @@ -17,6 +19,29 @@ jobs: git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Extract Issue Data + id: extract_data + run: | + echo "Extracting data from issue body" + + # Extract prompt_name + prompt_name="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt Name$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV + + # Extract author + author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + echo "AUTHOR=$author" >> $GITHUB_ENV + + # Extract tags + tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + echo "TAGS=$tags" >> $GITHUB_ENV + + # Extract prompt content + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/ {if ($0 !~ /^###/ && $0 != "") print}' )" + echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV + echo "$prompt_content" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - name: Create Branch id: branch_name run: | @@ -24,15 +49,36 @@ jobs: echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT git checkout -b $BRANCH_NAME - - name: Debug Branch Name + - name: Debug Extracted Data run: | - echo "Branch name is: ${{ steps.branch_name.outputs.branch }}" + echo "Prompt Name: ${{ env.PROMPT_NAME }}" + echo "Author: ${{ env.AUTHOR }}" + echo "Tags: ${{ env.TAGS }}" + echo "Prompt Content:" + echo "${{ env.PROMPT_CONTENT }}" - name: Create File from Issue run: | - echo '${{ toJson(github.event.issue.body) }}' | jq -r '.' > "issue-${{ github.event.issue.number }}.md" - git add . - git commit -m "Add issue content for #${{ github.event.issue.number }}" + # Sanitize prompt name to create a valid file name + FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g;s/^-+|-+$//g')" + FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" + + echo "Creating file at $FILE_PATH" + + mkdir -p "$(dirname "$FILE_PATH")" + + cat <<EOF > "$FILE_PATH" + --- + title: "${{ env.PROMPT_NAME }}" + author: "${{ env.AUTHOR }}" + tags: [${{ env.TAGS }}] + --- + + ${{ env.PROMPT_CONTENT }} + EOF + + git add "$FILE_PATH" + git commit -m "Add prompt '${{ env.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" - name: Push Branch run: | @@ -44,7 +90,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} base: main # Ensure this is the correct base branch - title: "PR for Issue #${{ github.event.issue.number }}" + title: "Add Prompt: ${{ env.PROMPT_NAME }}" body: | - This pull request addresses Issue #${{ github.event.issue.number }}. + Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. From f555f62e997608bb20c564ab8720db61bd572df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:56:56 +0100 Subject: [PATCH 11/42] Update issue-to-pr.yml From 6c02bbe5182cf94cd16144632f2d0f03dbb5484c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:59:01 +0100 Subject: [PATCH 12/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 22376b0..dfc0c3b 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -24,8 +24,8 @@ jobs: run: | echo "Extracting data from issue body" - # Extract prompt_name - prompt_name="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt Name$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + # Set PROMPT_NAME to the issue title + prompt_name="${{ github.event.issue.title }}" echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV # Extract author @@ -37,7 +37,7 @@ jobs: echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/ {if ($0 !~ /^###/ && $0 != "") print}' )" + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' )" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV @@ -47,7 +47,7 @@ jobs: run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b $BRANCH_NAME + git checkout -b "$BRANCH_NAME" - name: Debug Extracted Data run: | @@ -60,22 +60,22 @@ jobs: - name: Create File from Issue run: | # Sanitize prompt name to create a valid file name - FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g;s/^-+|-+$//g')" + FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" echo "Creating file at $FILE_PATH" mkdir -p "$(dirname "$FILE_PATH")" - cat <<EOF > "$FILE_PATH" - --- - title: "${{ env.PROMPT_NAME }}" - author: "${{ env.AUTHOR }}" - tags: [${{ env.TAGS }}] - --- + cat > "$FILE_PATH" <<EOF +--- +title: "${{ env.PROMPT_NAME }}" +author: "${{ env.AUTHOR }}" +tags: [${{ env.TAGS }}] +--- - ${{ env.PROMPT_CONTENT }} - EOF +${{ env.PROMPT_CONTENT }} +EOF git add "$FILE_PATH" git commit -m "Add prompt '${{ env.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" @@ -89,8 +89,11 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} - base: main # Ensure this is the correct base branch + base: main title: "Add Prompt: ${{ env.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. + body: | + Adds a new prompt from Issue #${{ github.event.issue.number }}. + Automatically generated by GitHub Actions. From 9bbc33b837c25933769f5702347c51d755b32b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:59:25 +0100 Subject: [PATCH 13/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index fbb60f4..e3fc8f9 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,20 +1,11 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. -title: "{{ prompt_name }}" +title: "{{ title }}" labels: [prompt] assignees: [] body: - - type: input - id: prompt_name - attributes: - label: Prompt Name - description: Enter the prompt name (used for file naming). - placeholder: "Diversity inclusion text enhancer" - validations: - required: true - - type: input id: author attributes: @@ -48,7 +39,7 @@ body: \`\`\` [TEXT] \`\`\` - render: yaml # This will render it in a code block. + render: yaml validations: required: true @@ -56,7 +47,7 @@ body: attributes: value: | --- - title: "{{ prompt_name }}" + title: "{{ ISSUE_TITLE }}" author: "{{ author }}" tags: [{{ tags }}] --- From 7a6c4d40ef5f84fd227d65d403d4052f789ac340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:04:32 +0100 Subject: [PATCH 14/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index dfc0c3b..f492407 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -3,8 +3,6 @@ name: Issue to PR Automation on: issues: types: [opened] - labels: - - 'prompt' jobs: create_pr: @@ -37,7 +35,7 @@ jobs: echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' )" + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/ {if ($0 !~ /^###/ && $0 != "") print}' )" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV @@ -94,6 +92,3 @@ EOF body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. - body: | - Adds a new prompt from Issue #${{ github.event.issue.number }}. - Automatically generated by GitHub Actions. From e82e09dd6fe78ba3be0f8ffb61ca44c1f42a7ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:08:47 +0100 Subject: [PATCH 15/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index e3fc8f9..0b746f7 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,7 +1,7 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. -title: "{{ title }}" +title: "Add here the title of the prompt" labels: [prompt] assignees: [] From 68169b75be045a496b97be8ea1c2b26afc24e102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:10:03 +0100 Subject: [PATCH 16/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index 0b746f7..da96ac2 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,8 +1,9 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. -title: "Add here the title of the prompt" +title: "" labels: [prompt] +placeholder: "Add here the title of the prompt" assignees: [] body: From 8df34557035f718436acb3faf55ce7bf86c96db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:10:31 +0100 Subject: [PATCH 17/42] Update 00_prompt.yml --- .github/ISSUE_TEMPLATE/00_prompt.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/00_prompt.yml b/.github/ISSUE_TEMPLATE/00_prompt.yml index da96ac2..9da1a8e 100644 --- a/.github/ISSUE_TEMPLATE/00_prompt.yml +++ b/.github/ISSUE_TEMPLATE/00_prompt.yml @@ -1,9 +1,8 @@ --- name: 📖 Prompt for AIDA Marketplace description: Template for generating a prompt in the AIDA Marketplace. -title: "" +title: Add here the title of the prompt labels: [prompt] -placeholder: "Add here the title of the prompt" assignees: [] body: From b9faba5c9abe37938f77d9f50fe2dc0ed7940b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:11:10 +0100 Subject: [PATCH 18/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index f492407..d48a907 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -35,7 +35,7 @@ jobs: echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/ {if ($0 !~ /^###/ && $0 != "") print}' )" + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}' )" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV From 6b404825a53138850d0afb962642e3d758ee82e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:15:34 +0100 Subject: [PATCH 19/42] Update issue-to-pr.yml From 5f25de0805aae358047a50ab27b22e1a4a3f6163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:21:44 +0100 Subject: [PATCH 20/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index d48a907..45e1721 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -1,4 +1,4 @@ -name: Issue to PR Automation +name: issue-to-pr-automation on: issues: From a756a1a852bc4e03980bdb6a1e8e745337bcd961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:28:04 +0100 Subject: [PATCH 21/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 69 +++++-------------------------- 1 file changed, 10 insertions(+), 59 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 45e1721..cdf589b 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -1,4 +1,4 @@ -name: issue-to-pr-automation +name: Issue to PR Automation on: issues: @@ -16,79 +16,30 @@ jobs: run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' - - - name: Extract Issue Data - id: extract_data - run: | - echo "Extracting data from issue body" - - # Set PROMPT_NAME to the issue title - prompt_name="${{ github.event.issue.title }}" - echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV - - # Extract author - author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" - echo "AUTHOR=$author" >> $GITHUB_ENV - - # Extract tags - tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" - echo "TAGS=$tags" >> $GITHUB_ENV - - # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}' )" - echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV - echo "$prompt_content" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - name: Create Branch id: branch_name run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH_NAME" - - - name: Debug Extracted Data + git checkout -b $BRANCH_NAME + - name: Debug Branch Name run: | - echo "Prompt Name: ${{ env.PROMPT_NAME }}" - echo "Author: ${{ env.AUTHOR }}" - echo "Tags: ${{ env.TAGS }}" - echo "Prompt Content:" - echo "${{ env.PROMPT_CONTENT }}" - + echo "Branch name is: ${{ steps.branch_name.outputs.branch }}" - name: Create File from Issue run: | - # Sanitize prompt name to create a valid file name - FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" - FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" - - echo "Creating file at $FILE_PATH" - - mkdir -p "$(dirname "$FILE_PATH")" - - cat > "$FILE_PATH" <<EOF ---- -title: "${{ env.PROMPT_NAME }}" -author: "${{ env.AUTHOR }}" -tags: [${{ env.TAGS }}] ---- - -${{ env.PROMPT_CONTENT }} -EOF - - git add "$FILE_PATH" - git commit -m "Add prompt '${{ env.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" - + echo '${{ toJson(github.event.issue.body) }}' | jq -r '.' > "issue-${{ github.event.issue.number }}.md" + git add . + git commit -m "Add issue content for #${{ github.event.issue.number }}" - name: Push Branch run: | git push origin HEAD - - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} - base: main - title: "Add Prompt: ${{ env.PROMPT_NAME }}" + base: main # Ensure this is the correct base branch + title: "PR for Issue #${{ github.event.issue.number }}" body: | - Adds a new prompt from Issue #${{ github.event.issue.number }}. + This pull request addresses Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. From 991777fad73cec7e9b1098b93d0be9808c7f034b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:30:58 +0100 Subject: [PATCH 22/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 67 ++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index cdf589b..d48a907 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -16,30 +16,79 @@ jobs: run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Extract Issue Data + id: extract_data + run: | + echo "Extracting data from issue body" + + # Set PROMPT_NAME to the issue title + prompt_name="${{ github.event.issue.title }}" + echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV + + # Extract author + author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + echo "AUTHOR=$author" >> $GITHUB_ENV + + # Extract tags + tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + echo "TAGS=$tags" >> $GITHUB_ENV + + # Extract prompt content + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}' )" + echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV + echo "$prompt_content" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - name: Create Branch id: branch_name run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b $BRANCH_NAME - - name: Debug Branch Name + git checkout -b "$BRANCH_NAME" + + - name: Debug Extracted Data run: | - echo "Branch name is: ${{ steps.branch_name.outputs.branch }}" + echo "Prompt Name: ${{ env.PROMPT_NAME }}" + echo "Author: ${{ env.AUTHOR }}" + echo "Tags: ${{ env.TAGS }}" + echo "Prompt Content:" + echo "${{ env.PROMPT_CONTENT }}" + - name: Create File from Issue run: | - echo '${{ toJson(github.event.issue.body) }}' | jq -r '.' > "issue-${{ github.event.issue.number }}.md" - git add . - git commit -m "Add issue content for #${{ github.event.issue.number }}" + # Sanitize prompt name to create a valid file name + FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" + FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" + + echo "Creating file at $FILE_PATH" + + mkdir -p "$(dirname "$FILE_PATH")" + + cat > "$FILE_PATH" <<EOF +--- +title: "${{ env.PROMPT_NAME }}" +author: "${{ env.AUTHOR }}" +tags: [${{ env.TAGS }}] +--- + +${{ env.PROMPT_CONTENT }} +EOF + + git add "$FILE_PATH" + git commit -m "Add prompt '${{ env.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" + - name: Push Branch run: | git push origin HEAD + - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} - base: main # Ensure this is the correct base branch - title: "PR for Issue #${{ github.event.issue.number }}" + base: main + title: "Add Prompt: ${{ env.PROMPT_NAME }}" body: | - This pull request addresses Issue #${{ github.event.issue.number }}. + Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. From 365f79406eac31a3f3f882ce93de9086d42d7583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:40:55 +0100 Subject: [PATCH 23/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index d48a907..36fa375 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -35,7 +35,7 @@ jobs: echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}' )" + prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}')" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV @@ -49,16 +49,16 @@ jobs: - name: Debug Extracted Data run: | - echo "Prompt Name: ${{ env.PROMPT_NAME }}" - echo "Author: ${{ env.AUTHOR }}" - echo "Tags: ${{ env.TAGS }}" + echo "Prompt Name: $PROMPT_NAME" + echo "Author: $AUTHOR" + echo "Tags: $TAGS" echo "Prompt Content:" - echo "${{ env.PROMPT_CONTENT }}" + echo "$PROMPT_CONTENT" - name: Create File from Issue run: | # Sanitize prompt name to create a valid file name - FILE_NAME="$(echo "${{ env.PROMPT_NAME }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" + FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" echo "Creating file at $FILE_PATH" @@ -67,16 +67,16 @@ jobs: cat > "$FILE_PATH" <<EOF --- -title: "${{ env.PROMPT_NAME }}" -author: "${{ env.AUTHOR }}" -tags: [${{ env.TAGS }}] +title: "$PROMPT_NAME" +author: "$AUTHOR" +tags: [$TAGS] --- -${{ env.PROMPT_CONTENT }} +$PROMPT_CONTENT EOF git add "$FILE_PATH" - git commit -m "Add prompt '${{ env.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" + git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" - name: Push Branch run: | @@ -88,7 +88,7 @@ EOF token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} base: main - title: "Add Prompt: ${{ env.PROMPT_NAME }}" + title: "Add Prompt: $PROMPT_NAME" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. From a8c9dfecf1c5ca6d6683f6b2708a227f4b0827f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:47:50 +0100 Subject: [PATCH 24/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 36fa375..7fb1c05 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -27,11 +27,13 @@ jobs: echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV # Extract author - author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###|$/{if ($0 !~ /^###/ && $0 != "") print}' \ + | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "AUTHOR=$author" >> $GITHUB_ENV # Extract tags - tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###|$/{if ($0 !~ /^###/ && $0 != "") print}' \ + | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content @@ -58,22 +60,24 @@ jobs: - name: Create File from Issue run: | # Sanitize prompt name to create a valid file name - FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" + FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' \ + | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" echo "Creating file at $FILE_PATH" mkdir -p "$(dirname "$FILE_PATH")" - cat > "$FILE_PATH" <<EOF ---- -title: "$PROMPT_NAME" -author: "$AUTHOR" -tags: [$TAGS] ---- - -$PROMPT_CONTENT -EOF + # Use printf to write to the file + printf '%s\n' \ + '---' \ + "title: \"$PROMPT_NAME\"" \ + "author: \"$AUTHOR\"" \ + "tags: [$TAGS]" \ + '---' \ + '' \ + "$PROMPT_CONTENT" \ + > "$FILE_PATH" git add "$FILE_PATH" git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" From 61358c3c95204d36a168332c965f2ff7d32ddda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:53:57 +0100 Subject: [PATCH 25/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 7fb1c05..a10544d 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -26,18 +26,24 @@ jobs: prompt_name="${{ github.event.issue.title }}" echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV + # Save the issue body into a variable safely + issue_body=$(printf '%s' "${{ github.event.issue.body }}") + # Extract author - author="$(echo "${{ github.event.issue.body }}" | awk '/^### Author$/,/^###|$/{if ($0 !~ /^###/ && $0 != "") print}' \ + author="$(printf '%s' "$issue_body" \ + | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' \ | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "AUTHOR=$author" >> $GITHUB_ENV # Extract tags - tags="$(echo "${{ github.event.issue.body }}" | awk '/^### Tags$/,/^###|$/{if ($0 !~ /^###/ && $0 != "") print}' \ + tags="$(printf '%s' "$issue_body" \ + | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' \ | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(echo "${{ github.event.issue.body }}" | awk '/^### Prompt$/,/^$/{if ($0 !~ /^###/ && $0 != "") print}')" + prompt_content="$(printf '%s' "$issue_body" \ + | awk '/^### Prompt$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}')" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV From 02d5a7f919147e5b902c6a12a5e5259e2cd645ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:57:02 +0100 Subject: [PATCH 26/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index a10544d..cf0b040 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -26,28 +26,26 @@ jobs: prompt_name="${{ github.event.issue.title }}" echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV - # Save the issue body into a variable safely - issue_body=$(printf '%s' "${{ github.event.issue.body }}") + # Write the issue body to a temporary file + printf '%s' "${{ github.event.issue.body }}" > issue_body.txt # Extract author - author="$(printf '%s' "$issue_body" \ - | awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' \ - | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + author="$(awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "AUTHOR=$author" >> $GITHUB_ENV # Extract tags - tags="$(printf '%s' "$issue_body" \ - | awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' \ - | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + tags="$(awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" echo "TAGS=$tags" >> $GITHUB_ENV # Extract prompt content - prompt_content="$(printf '%s' "$issue_body" \ - | awk '/^### Prompt$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}')" + prompt_content="$(awk '/^### Prompt$/,/^###|^$/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt)" echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV echo "$prompt_content" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV + # Remove the temporary file + rm issue_body.txt + - name: Create Branch id: branch_name run: | From d479ce0f9bca53524dbc0c62b29e73006848a2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:00:24 +0100 Subject: [PATCH 27/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 83 +++++++++++++++++++------------ 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index cf0b040..7048f43 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -19,39 +19,49 @@ jobs: - name: Extract Issue Data id: extract_data - run: | - echo "Extracting data from issue body" - - # Set PROMPT_NAME to the issue title - prompt_name="${{ github.event.issue.title }}" - echo "PROMPT_NAME=$prompt_name" >> $GITHUB_ENV - - # Write the issue body to a temporary file - printf '%s' "${{ github.event.issue.body }}" > issue_body.txt - - # Extract author - author="$(awk '/^### Author$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" - echo "AUTHOR=$author" >> $GITHUB_ENV - - # Extract tags - tags="$(awk '/^### Tags$/,/^###/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" - echo "TAGS=$tags" >> $GITHUB_ENV - - # Extract prompt content - prompt_content="$(awk '/^### Prompt$/,/^###|^$/{if ($0 !~ /^###/ && $0 != "") print}' issue_body.txt)" - echo "PROMPT_CONTENT<<EOF" >> $GITHUB_ENV - echo "$prompt_content" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - # Remove the temporary file - rm issue_body.txt - - - name: Create Branch - id: branch_name - run: | - BRANCH_NAME="issue-${{ github.event.issue.number }}" - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH_NAME" + uses: actions/github-script@v6 + with: + script: | + const issueBody = `\n${{ github.event.issue.body }}`; + const fs = require('fs'); + + // Write issue body to file + fs.writeFileSync('issue_body.txt', issueBody); + + // Split issue body into lines + const lines = issueBody.split('\n'); + + function extractSection(header) { + const sectionLines = []; + let inSection = false; + + for (const line of lines) { + if (line.trim() === `### ${header}`) { + inSection = true; + continue; + } + if (inSection && line.startsWith('### ')) { + break; + } + if (inSection) { + sectionLines.push(line); + } + } + return sectionLines.join('\n').trim(); + } + + const promptName = `${{ github.event.issue.title }}`; + const author = extractSection('Author'); + const tags = extractSection('Tags'); + const promptContent = extractSection('Prompt'); + + // Set environment variables + fs.appendFileSync(process.env.GITHUB_ENV, `PROMPT_NAME=${promptName}\n`); + fs.appendFileSync(process.env.GITHUB_ENV, `AUTHOR=${author}\n`); + fs.appendFileSync(process.env.GITHUB_ENV, `TAGS=${tags}\n`); + + // Handle multi-line environment variable + fs.appendFileSync(process.env.GITHUB_ENV, `PROMPT_CONTENT<<EOF\n${promptContent}\nEOF\n`); - name: Debug Extracted Data run: | @@ -61,6 +71,13 @@ jobs: echo "Prompt Content:" echo "$PROMPT_CONTENT" + - name: Create Branch + id: branch_name + run: | + BRANCH_NAME="issue-${{ github.event.issue.number }}" + echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + git checkout -b "$BRANCH_NAME" + - name: Create File from Issue run: | # Sanitize prompt name to create a valid file name From d08b8725685f119fa6b79782cccd26511355ba88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:04:12 +0100 Subject: [PATCH 28/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 7048f43..c8947be 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,7 +22,9 @@ jobs: uses: actions/github-script@v6 with: script: | - const issueBody = `\n${{ github.event.issue.body }}`; + // Safely serialize the issue body + const issueBody = JSON.parse(${{ toJSON(github.event.issue.body) }}); + const promptName = `${{ toJSON(github.event.issue.title) }}`; const fs = require('fs'); // Write issue body to file @@ -50,7 +52,6 @@ jobs: return sectionLines.join('\n').trim(); } - const promptName = `${{ github.event.issue.title }}`; const author = extractSection('Author'); const tags = extractSection('Tags'); const promptContent = extractSection('Prompt'); From 76deff848d3ed7c8d961c2fe55b37ba1922f9381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:07:04 +0100 Subject: [PATCH 29/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index c8947be..03b1766 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,9 +22,8 @@ jobs: uses: actions/github-script@v6 with: script: | - // Safely serialize the issue body - const issueBody = JSON.parse(${{ toJSON(github.event.issue.body) }}); - const promptName = `${{ toJSON(github.event.issue.title) }}`; + const issueBody = github.event.issue.body; + const promptName = github.event.issue.title; const fs = require('fs'); // Write issue body to file @@ -62,7 +61,10 @@ jobs: fs.appendFileSync(process.env.GITHUB_ENV, `TAGS=${tags}\n`); // Handle multi-line environment variable - fs.appendFileSync(process.env.GITHUB_ENV, `PROMPT_CONTENT<<EOF\n${promptContent}\nEOF\n`); + fs.appendFileSync( + process.env.GITHUB_ENV, + `PROMPT_CONTENT<<EOF\n${promptContent}\nEOF\n` + ); - name: Debug Extracted Data run: | From 1bf1ec524b86580504ac02cf4661a8a71bf9ceb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:12:36 +0100 Subject: [PATCH 30/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 03b1766..5d2dac8 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,8 +22,8 @@ jobs: uses: actions/github-script@v6 with: script: | - const issueBody = github.event.issue.body; - const promptName = github.event.issue.title; + const issueBody = context.payload.issue.body; + const promptName = context.payload.issue.title; const fs = require('fs'); // Write issue body to file From 5439d7764bcf62253956b8b3323cd30e6a5098a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:18:12 +0100 Subject: [PATCH 31/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 5d2dac8..3571103 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -86,7 +86,7 @@ jobs: # Sanitize prompt name to create a valid file name FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' \ | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" - FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" + FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" # Ensure the file has a .md extension echo "Creating file at $FILE_PATH" From ded32d9b0432fc76a4c78ca2364d694b58162143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:09:35 +0100 Subject: [PATCH 32/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 49 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 3571103..a145c2a 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,14 +22,10 @@ jobs: uses: actions/github-script@v6 with: script: | + const core = require('@actions/core'); const issueBody = context.payload.issue.body; - const promptName = context.payload.issue.title; - const fs = require('fs'); + const issueTitle = context.payload.issue.title; - // Write issue body to file - fs.writeFileSync('issue_body.txt', issueBody); - - // Split issue body into lines const lines = issueBody.split('\n'); function extractSection(header) { @@ -37,7 +33,7 @@ jobs: let inSection = false; for (const line of lines) { - if (line.trim() === `### ${header}`) { + if (line.trim().toLowerCase() === `### ${header.toLowerCase()}`) { inSection = true; continue; } @@ -55,27 +51,22 @@ jobs: const tags = extractSection('Tags'); const promptContent = extractSection('Prompt'); - // Set environment variables - fs.appendFileSync(process.env.GITHUB_ENV, `PROMPT_NAME=${promptName}\n`); - fs.appendFileSync(process.env.GITHUB_ENV, `AUTHOR=${author}\n`); - fs.appendFileSync(process.env.GITHUB_ENV, `TAGS=${tags}\n`); - - // Handle multi-line environment variable - fs.appendFileSync( - process.env.GITHUB_ENV, - `PROMPT_CONTENT<<EOF\n${promptContent}\nEOF\n` - ); + // Set outputs + core.setOutput('PROMPT_NAME', issueTitle); + core.setOutput('AUTHOR', author); + core.setOutput('TAGS', tags); + core.setOutput('PROMPT_CONTENT', promptContent); - name: Debug Extracted Data run: | - echo "Prompt Name: $PROMPT_NAME" - echo "Author: $AUTHOR" - echo "Tags: $TAGS" + echo "Prompt Name: ${{ steps.extract_data.outputs.PROMPT_NAME }}" + echo "Author: ${{ steps.extract_data.outputs.AUTHOR }}" + echo "Tags: ${{ steps.extract_data.outputs.TAGS }}" echo "Prompt Content:" - echo "$PROMPT_CONTENT" + echo "${{ steps.extract_data.outputs.PROMPT_CONTENT }}" - name: Create Branch - id: branch_name + id: create_branch run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT @@ -83,16 +74,22 @@ jobs: - name: Create File from Issue run: | + # Retrieve variables + PROMPT_NAME="${{ steps.extract_data.outputs.PROMPT_NAME }}" + AUTHOR="${{ steps.extract_data.outputs.AUTHOR }}" + TAGS="${{ steps.extract_data.outputs.TAGS }}" + PROMPT_CONTENT="${{ steps.extract_data.outputs.PROMPT_CONTENT }}" + # Sanitize prompt name to create a valid file name FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' \ | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" - FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" # Ensure the file has a .md extension + FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" echo "Creating file at $FILE_PATH" mkdir -p "$(dirname "$FILE_PATH")" - # Use printf to write to the file + # Write the content to the .md file using printf printf '%s\n' \ '---' \ "title: \"$PROMPT_NAME\"" \ @@ -114,9 +111,9 @@ jobs: uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.branch_name.outputs.branch }} + branch: ${{ steps.create_branch.outputs.branch }} base: main - title: "Add Prompt: $PROMPT_NAME" + title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. From 05098c9d0d61c200587d14d94817c930013829e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:12:02 +0100 Subject: [PATCH 33/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index a145c2a..2beb561 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,7 +22,6 @@ jobs: uses: actions/github-script@v6 with: script: | - const core = require('@actions/core'); const issueBody = context.payload.issue.body; const issueTitle = context.payload.issue.title; From 646ab14299ddab24df5dbdddf278204fa4700edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:18:25 +0100 Subject: [PATCH 34/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 2beb561..a8221b0 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -6,7 +6,7 @@ on: jobs: create_pr: - if: contains( toJson( github.event.issue.labels ), '"prompt"' ) + if: contains(toJson(github.event.issue.labels), '"prompt"') runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -14,14 +14,15 @@ jobs: - name: Set up Git Config run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: Extract Issue Data id: extract_data uses: actions/github-script@v6 with: script: | + // 'core' is already provided by actions/github-script const issueBody = context.payload.issue.body; const issueTitle = context.payload.issue.title; @@ -62,13 +63,13 @@ jobs: echo "Author: ${{ steps.extract_data.outputs.AUTHOR }}" echo "Tags: ${{ steps.extract_data.outputs.TAGS }}" echo "Prompt Content:" - echo "${{ steps.extract_data.outputs.PROMPT_CONTENT }}" + printf '%s\n' "${{ steps.extract_data.outputs.PROMPT_CONTENT }}" - name: Create Branch id: create_branch run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT" git checkout -b "$BRANCH_NAME" - name: Create File from Issue @@ -93,7 +94,7 @@ jobs: '---' \ "title: \"$PROMPT_NAME\"" \ "author: \"$AUTHOR\"" \ - "tags: [$TAGS]" \ + "tags: [${TAGS}]" \ '---' \ '' \ "$PROMPT_CONTENT" \ From ba157f243d1b849b9a9c489ec0a4a66754aa05cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:31:21 +0100 Subject: [PATCH 35/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index a8221b0..c5f94fc 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,7 +22,6 @@ jobs: uses: actions/github-script@v6 with: script: | - // 'core' is already provided by actions/github-script const issueBody = context.payload.issue.body; const issueTitle = context.payload.issue.title; @@ -51,11 +50,14 @@ jobs: const tags = extractSection('Tags'); const promptContent = extractSection('Prompt'); + // Base64 encode the prompt content + const promptContentB64 = Buffer.from(promptContent, 'utf-8').toString('base64'); + // Set outputs core.setOutput('PROMPT_NAME', issueTitle); core.setOutput('AUTHOR', author); core.setOutput('TAGS', tags); - core.setOutput('PROMPT_CONTENT', promptContent); + core.setOutput('PROMPT_CONTENT_B64', promptContentB64); - name: Debug Extracted Data run: | @@ -63,7 +65,7 @@ jobs: echo "Author: ${{ steps.extract_data.outputs.AUTHOR }}" echo "Tags: ${{ steps.extract_data.outputs.TAGS }}" echo "Prompt Content:" - printf '%s\n' "${{ steps.extract_data.outputs.PROMPT_CONTENT }}" + echo "${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" | base64 --decode - name: Create Branch id: create_branch @@ -78,7 +80,10 @@ jobs: PROMPT_NAME="${{ steps.extract_data.outputs.PROMPT_NAME }}" AUTHOR="${{ steps.extract_data.outputs.AUTHOR }}" TAGS="${{ steps.extract_data.outputs.TAGS }}" - PROMPT_CONTENT="${{ steps.extract_data.outputs.PROMPT_CONTENT }}" + PROMPT_CONTENT_B64="${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" + + # Decode the base64 content + PROMPT_CONTENT=$(echo "$PROMPT_CONTENT_B64" | base64 --decode) # Sanitize prompt name to create a valid file name FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' \ @@ -89,16 +94,16 @@ jobs: mkdir -p "$(dirname "$FILE_PATH")" - # Write the content to the .md file using printf - printf '%s\n' \ - '---' \ - "title: \"$PROMPT_NAME\"" \ - "author: \"$AUTHOR\"" \ - "tags: [${TAGS}]" \ - '---' \ - '' \ - "$PROMPT_CONTENT" \ - > "$FILE_PATH" + # Write the content to the .md file using cat + { + echo '---' + echo "title: \"$PROMPT_NAME\"" + echo "author: \"$AUTHOR\"" + echo "tags: [${TAGS}]" + echo '---' + echo + echo "$PROMPT_CONTENT" + } > "$FILE_PATH" git add "$FILE_PATH" git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" From 0aba76f13033f95ec1fed77e5c38b9e170f1c4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:40:19 +0100 Subject: [PATCH 36/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index c5f94fc..9f8cae1 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -105,12 +105,8 @@ jobs: echo "$PROMPT_CONTENT" } > "$FILE_PATH" - git add "$FILE_PATH" - git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" - - - name: Push Branch - run: | - git push origin HEAD + # Remove 'Push Branch' and 'git commit' step + # The create-pull-request action will handle committing and pushing changes - name: Create Pull Request uses: peter-evans/create-pull-request@v5 @@ -122,3 +118,6 @@ jobs: body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. + commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" + committer: 'GitHub <noreply@github.com>' + author: 'Your Name <your-email@example.com>' From 3d366ef943da1ee7361d802acf73d9490f49dad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:46:12 +0100 Subject: [PATCH 37/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 9f8cae1..f5ea8f8 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -67,12 +67,8 @@ jobs: echo "Prompt Content:" echo "${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" | base64 --decode - - name: Create Branch - id: create_branch - run: | - BRANCH_NAME="issue-${{ github.event.issue.number }}" - echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT" - git checkout -b "$BRANCH_NAME" + # Remove the 'Create Branch' step + # The action will handle creating the branch - name: Create File from Issue run: | @@ -105,19 +101,20 @@ jobs: echo "$PROMPT_CONTENT" } > "$FILE_PATH" - # Remove 'Push Branch' and 'git commit' step - # The create-pull-request action will handle committing and pushing changes + # Do not add or commit changes here - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.create_branch.outputs.branch }} - base: main + commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" + committer: 'GitHub <noreply@github.com>' + author: 'Your Name <your-email@example.com>' title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. - commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" - committer: 'GitHub <noreply@github.com>' - author: 'Your Name <your-email@example.com>' + branch: "issue-${{ github.event.issue.number }}" + branch-suffix: "none" + delete-branch: false + overwrite-existing: true From de69dbc3c8a80966578e518dac4b736ecb291577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:51:52 +0100 Subject: [PATCH 38/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index f5ea8f8..1428ff3 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -101,20 +101,17 @@ jobs: echo "$PROMPT_CONTENT" } > "$FILE_PATH" - # Do not add or commit changes here + git add "$FILE_PATH" + git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" + # Do not add or commit changes here - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" - committer: 'GitHub <noreply@github.com>' - author: 'Your Name <your-email@example.com>' - title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" + branch: ${{ steps.branch_name.outputs.branch }} + base: main + title: "Add Prompt: $PROMPT_NAME" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. - branch: "issue-${{ github.event.issue.number }}" - branch-suffix: "none" - delete-branch: false - overwrite-existing: true From 738cdbdf6abe3a40e062cd0896bc056736eef7f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:54:31 +0100 Subject: [PATCH 39/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 1428ff3..42a516a 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -67,9 +67,14 @@ jobs: echo "Prompt Content:" echo "${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" | base64 --decode - # Remove the 'Create Branch' step # The action will handle creating the branch - + - name: Create Branch + id: branch_name + run: | + BRANCH_NAME="issue-${{ github.event.issue.number }}" + echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT + git checkout -b "$BRANCH_NAME" + - name: Create File from Issue run: | # Retrieve variables From a304e22aa5959716e340da6ba7690b032dc4a9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:01:51 +0100 Subject: [PATCH 40/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 42a516a..5b15e4f 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,15 +22,13 @@ jobs: uses: actions/github-script@v6 with: script: | + // 'core' is already provided by actions/github-script const issueBody = context.payload.issue.body; const issueTitle = context.payload.issue.title; - const lines = issueBody.split('\n'); - function extractSection(header) { const sectionLines = []; let inSection = false; - for (const line of lines) { if (line.trim().toLowerCase() === `### ${header.toLowerCase()}`) { inSection = true; @@ -45,14 +43,11 @@ jobs: } return sectionLines.join('\n').trim(); } - const author = extractSection('Author'); const tags = extractSection('Tags'); const promptContent = extractSection('Prompt'); - // Base64 encode the prompt content const promptContentB64 = Buffer.from(promptContent, 'utf-8').toString('base64'); - // Set outputs core.setOutput('PROMPT_NAME', issueTitle); core.setOutput('AUTHOR', author); @@ -67,14 +62,13 @@ jobs: echo "Prompt Content:" echo "${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" | base64 --decode - # The action will handle creating the branch - name: Create Branch id: branch_name run: | BRANCH_NAME="issue-${{ github.event.issue.number }}" echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT git checkout -b "$BRANCH_NAME" - + - name: Create File from Issue run: | # Retrieve variables @@ -82,19 +76,14 @@ jobs: AUTHOR="${{ steps.extract_data.outputs.AUTHOR }}" TAGS="${{ steps.extract_data.outputs.TAGS }}" PROMPT_CONTENT_B64="${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" - # Decode the base64 content PROMPT_CONTENT=$(echo "$PROMPT_CONTENT_B64" | base64 --decode) - # Sanitize prompt name to create a valid file name FILE_NAME="$(echo "$PROMPT_NAME" | tr '[:upper:]' '[:lower:]' \ | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')" FILE_PATH="aida-prompts/_prompts/${FILE_NAME}.md" - echo "Creating file at $FILE_PATH" - mkdir -p "$(dirname "$FILE_PATH")" - # Write the content to the .md file using cat { echo '---' @@ -105,18 +94,25 @@ jobs: echo echo "$PROMPT_CONTENT" } > "$FILE_PATH" - git add "$FILE_PATH" git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" - # Do not add or commit changes here + - name: Push Branch + run: | + BRANCH_NAME="${{ steps.branch_name.outputs.branch }}" + git push origin "$BRANCH_NAME" + - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ steps.branch_name.outputs.branch }} base: main - title: "Add Prompt: $PROMPT_NAME" + title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. + committer: 'GitHub <noreply@github.com>' + author: 'Your Name <your-email@example.com>' + skip-commits: true + overwrite-existing: true From 415135d32ef843f73f2cad8df9d94287cb21626a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:10:06 +0100 Subject: [PATCH 41/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 5b15e4f..06a8d76 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -22,7 +22,6 @@ jobs: uses: actions/github-script@v6 with: script: | - // 'core' is already provided by actions/github-script const issueBody = context.payload.issue.body; const issueTitle = context.payload.issue.title; const lines = issueBody.split('\n'); @@ -62,12 +61,7 @@ jobs: echo "Prompt Content:" echo "${{ steps.extract_data.outputs.PROMPT_CONTENT_B64 }}" | base64 --decode - - name: Create Branch - id: branch_name - run: | - BRANCH_NAME="issue-${{ github.event.issue.number }}" - echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH_NAME" + # Remove 'Create Branch' and 'Push Branch' steps - name: Create File from Issue run: | @@ -94,25 +88,21 @@ jobs: echo echo "$PROMPT_CONTENT" } > "$FILE_PATH" - git add "$FILE_PATH" - git commit -m "Add prompt '$PROMPT_NAME' from Issue #${{ github.event.issue.number }}" - - - name: Push Branch - run: | - BRANCH_NAME="${{ steps.branch_name.outputs.branch }}" - git push origin "$BRANCH_NAME" + # Do not commit changes here - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.branch_name.outputs.branch }} - base: main + commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" + committer: 'GitHub <noreply@github.com>' + author: 'Your Name <your-email@example.com>' # Replace with your details or use a generic name title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. - committer: 'GitHub <noreply@github.com>' - author: 'Your Name <your-email@example.com>' - skip-commits: true + branch: "issue-${{ github.event.issue.number }}" + branch-suffix: "none" + base: main + delete-branch: false overwrite-existing: true From 43212495aebb501a8ff2df0907624e71d7629c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Mart=C3=ADn?= <albertinisg@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:13:26 +0100 Subject: [PATCH 42/42] Update issue-to-pr.yml --- .github/workflows/issue-to-pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/issue-to-pr.yml b/.github/workflows/issue-to-pr.yml index 06a8d76..9bbf4a5 100644 --- a/.github/workflows/issue-to-pr.yml +++ b/.github/workflows/issue-to-pr.yml @@ -96,13 +96,12 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Add prompt '${{ steps.extract_data.outputs.PROMPT_NAME }}' from Issue #${{ github.event.issue.number }}" committer: 'GitHub <noreply@github.com>' - author: 'Your Name <your-email@example.com>' # Replace with your details or use a generic name + author: 'Your Name <your-email@example.com>' # Replace with your name and email title: "Add Prompt: ${{ steps.extract_data.outputs.PROMPT_NAME }}" body: | Adds a new prompt from Issue #${{ github.event.issue.number }}. Automatically generated by GitHub Actions. branch: "issue-${{ github.event.issue.number }}" - branch-suffix: "none" base: main delete-branch: false overwrite-existing: true