Skip to content

Commit

Permalink
ci: fix bad escaping for COMMENT_BODY (fixes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 2, 2023
1 parent 137a0db commit 5b1daa6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ jobs:
steps:
- name: Detect gptme command
id: detect_command
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
COMMENT_BODY="${{ github.event.comment.body }}"
# Check if the comment starts with "@gptme"
if [[ $COMMENT_BODY == "@gptme "* ]]; then
if [[ "$COMMENT_BODY" == "@gptme "* ]]; then
# Extract the command
GPTME_COMMAND=${COMMENT_BODY#"@gptme "}
echo "gptme_command=${GPTME_COMMAND}" >> $GITHUB_OUTPUT
# Escape double quotes
GPTME_COMMAND=${GPTME_COMMAND//\"/\\\"}
echo "gptme_command='${GPTME_COMMAND}'" >> $GITHUB_OUTPUT
fi
- name: Fail if author not on whitelist
Expand Down Expand Up @@ -94,10 +96,9 @@ jobs:
- name: Run gptme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPTME_COMMAND: ${{ needs.check-comment.outputs.gptme_command }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
GPTME_COMMAND="${{ needs.check-comment.outputs.gptme_command }}"
ISSUE_NUMBER="${{ github.event.issue.number }}"
gh issue view $ISSUE_NUMBER > issue.md
gh issue view $ISSUE_NUMBER -c > comments.md
Expand All @@ -109,13 +110,12 @@ jobs:
- name: Commit, push, comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPTME_COMMAND: ${{ needs.check-comment.outputs.gptme_command }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TYPE: ${{ github.event.issue.pull_request && 'pull_request' || 'issue' }}
REPO_NAME: ${{ github.event.repository.name }}
USER_NAME: ${{ github.event.repository.owner.login }}
run: |
GPTME_COMMAND="${{ needs.check-comment.outputs.gptme_command }}"
ISSUE_TYPE="${{ github.event.issue.pull_request && 'pull_request' || 'issue' }}"
ISSUE_NUMBER="${{ github.event.issue.number }}"
REPO_NAME="${{ github.event.repository.name }}"
USER_NAME="${{ github.event.repository.owner.login }}"
BRANCH_NAME="gptme-bot-changes-$(date +'%Y%m%d%H%M%S')"
BRANCH_BASE="master"
Expand Down

0 comments on commit 5b1daa6

Please sign in to comment.