From e41b5721fbd38a402446ddce561ca102a5b0a8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Mon, 10 Feb 2025 15:14:22 -0600 Subject: [PATCH] fix: Use plugin executable name to dispatch commands (#1945) --- .github/workflows/test-plugin-command.yml | 23 ++++++++++++++--------- .github/workflows/test_dispatcher.yml | 13 ++++++++++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-plugin-command.yml b/.github/workflows/test-plugin-command.yml index d30a708e3..baf148fc4 100644 --- a/.github/workflows/test-plugin-command.yml +++ b/.github/workflows/test-plugin-command.yml @@ -24,6 +24,10 @@ on: description: The pip_url for the plugin required: false default: '' + executable: + description: The executable name for the plugin + required: false + default: '' prepend-text: description: Text to be prepended to the command output required: false @@ -39,6 +43,7 @@ jobs: env: PLUGIN_NAME: ${{ github.event.inputs.name }} PIP_URL: ${{ github.event.inputs.pip-url }} + EXECUTABLE: ${{ github.event.inputs.executable || github.event.inputs.name }} steps: @@ -53,7 +58,7 @@ jobs: token: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }} repository: ${{ github.event.inputs.repository }} comment-id: ${{ github.event.inputs.comment-id }} - reaction-type: eyes + reactions: eyes - name: Set initial edit mode (to conditionally clear previous comment) id: initial-edit-mode @@ -109,31 +114,31 @@ jobs: - name: Print plugin help id: plugin-help run: | - ${{ env.PLUGIN_NAME }} --help 2>&1 | tee help-output.txt + ${{ env.EXECUTABLE }} --help 2>&1 | tee help-output.txt - name: Print plugin version id: plugin-version continue-on-error: true run: | - ${{ env.PLUGIN_NAME }} --version | tee version-output.txt + ${{ env.EXECUTABLE }} --version | tee version-output.txt - name: Print plugin about id: plugin-about continue-on-error: true run: | - ${{ env.PLUGIN_NAME }} --about --format=json | tee about-result.json + ${{ env.EXECUTABLE }} --about --format=json | tee about-result.json - name: Print plugin markdown id: plugin-markdown continue-on-error: true run: | - ${{ env.PLUGIN_NAME }} --about --format=markdown | tee markdown-result.md + ${{ env.EXECUTABLE }} --about --format=markdown | tee markdown-result.md - name: Print discovery output id: plugin-catalog continue-on-error: true run: | - ${{ env.PLUGIN_NAME }} --discover | tee catalog.json + ${{ env.EXECUTABLE }} --discover | tee catalog.json # Generates the JOB_OUTPUT env var, accessible via '${{ env.JOB_OUTPUT }}'' # Ref: https://trstringer.com/github-actions-multiline-strings/ @@ -155,7 +160,7 @@ jobs: fi echo "
Usage info" >> $GITHUB_ENV echo -e "\n\`\`\`" >> $GITHUB_ENV - echo "melty-bot % ${{ env.PLUGIN_NAME }} --help" >> $GITHUB_ENV + echo "melty-bot % ${{ env.EXECUTABLE }} --help" >> $GITHUB_ENV cat help-output.txt >> $GITHUB_ENV echo -e "\`\`\`\n" >> $GITHUB_ENV echo "
" >> $GITHUB_ENV @@ -219,7 +224,7 @@ jobs: token: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }} repository: ${{ github.event.inputs.repository }} comment-id: ${{ github.event.inputs.comment-id }} - reaction-type: hooray + reactions: hooray - name: Add reaction (failure) uses: peter-evans/create-or-update-comment@v4 @@ -228,4 +233,4 @@ jobs: token: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }} repository: ${{ github.event.inputs.repository }} comment-id: ${{ github.event.inputs.comment-id }} - reaction-type: confused + reactions: confused diff --git a/.github/workflows/test_dispatcher.yml b/.github/workflows/test_dispatcher.yml index f0f338d8a..7fa54bbd4 100644 --- a/.github/workflows/test_dispatcher.yml +++ b/.github/workflows/test_dispatcher.yml @@ -66,8 +66,10 @@ jobs: name="$(basename "$(dirname "${{ matrix.changed_file }}")")" pip_url="$(./yq '.pip_url // ""' "${{ matrix.changed_file }}")" variant="$(./yq '.variant' "${{ matrix.changed_file }}")" + executable="$(./yq '.executable' "${{ matrix.changed_file }}")" echo "name=${name}" >> $GITHUB_ENV echo "pip_url=${pip_url}" >> $GITHUB_ENV + echo "executable=${executable}" >> $GITHUB_ENV echo "prelude=Testing plugin \`${name}\` (\`${variant}\` variant):" >> $GITHUB_ENV - name: Find the MeltyBot test-command comment if it exists @@ -84,6 +86,15 @@ jobs: with: route: "POST /repos/${{ github.repository }}/actions/workflows/test-plugin-command.yml/dispatches" ref: 'main' - inputs: "{\"repository\":\"${{ github.repository }}\",\"comment-id\":\"${{ steps.find_comment.outputs.comment-id }}\",\"issue-number\":\"${{ github.event.pull_request.number }}\",\"name\":\"${{ env.name }}\",\"pip-url\":\"${{ env.pip_url }}\",\"prepend-text\":\"${{ env.prelude }}\"}" + inputs: | + { + "repository": "${{ github.repository }}", + "comment-id": "${{ steps.find_comment.outputs.comment-id }}", + "issue-number": "${{ github.event.pull_request.number }}", + "name": "${{ env.name }}", + "pip-url": "${{ env.pip_url }}", + "executable": "${{ env.executable }}", + "prepend-text": "${{ env.prelude }}" + } env: GITHUB_TOKEN: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }}