LLM responds to issues against the repository.π #3
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
name: "Alert-Menta: Reacts to specific commands" | |
run-name: LLM responds to issues against the repository.π | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
Alert-Menta: | |
if: startsWith(github.event.comment.body, '/describe') || startsWith(github.event.comment.body, '/suggest') || startsWith(github.event.comment.body, '/ask') | |
runs-on: ubuntu-22.04 | |
permissions: | |
issues: write | |
contents: read | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Download and Install alert-menta | |
run: | | |
curl -sLJO -H 'Accept: application/octet-stream' \ | |
"https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/assets/$( \ | |
curl -sL "https://${{ secrets.GH_TOKEN }}@api.github.com/repos/3-shake/alert-menta/releases/tags/v0.1.0" \ | |
| jq '.assets[] | select(.name | contains("Linux_x86")) | .id')" | |
tar -zxvf alert-menta_Linux_x86_64.tar.gz | |
- name: Set Command | |
id: set_command | |
run: | | |
COMMENT_BODY="${{ github.event.comment.body }}" | |
if [[ "$COMMENT_BODY" == /ask* ]]; then | |
COMMAND=ask | |
INTENT=${COMMENT_BODY:5} | |
echo "INTENT=$INTENT" >> $GITHUB_ENV | |
elif [[ "$COMMENT_BODY" == /describe* ]]; then | |
COMMAND=describe | |
elif [[ "$COMMENT_BODY" == /suggest* ]]; then | |
COMMAND=suggest | |
fi | |
echo "COMMAND=$COMMAND" >> $GITHUB_ENV | |
- run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" >> $GITHUB_ENV | |
- name: Get user defined config file | |
id: user_config | |
if: hashFiles('.alert-menta.user.yaml') != '' | |
run: | | |
curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" -L -o .alert-menta.user.yaml "https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ env.REPOSITORY_NAME }}/main/.alert-menta.user.yaml" && echo "CONFIG_FILE=./.alert-menta.user.yaml" >> $GITHUB_ENV | |
- name: Add Comment | |
run: | | |
if [[ "$COMMAND" == "ask" ]]; then | |
./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE -intent "$INTENT" | |
else | |
./alert-menta -owner ${{ github.repository_owner }} -issue ${{ github.event.issue.number }} -repo ${{ env.REPOSITORY_NAME }} -github-token ${{ secrets.GH_TOKEN }} -api-key ${{ secrets.OPENAI_API_KEY }} -command $COMMAND -config $CONFIG_FILE | |
fi |