diff --git a/.forgejo/actions/push-status-to-discord/action.yml b/.forgejo/actions/push-status-to-discord/action.yml index 44395a0..4f82d58 100644 --- a/.forgejo/actions/push-status-to-discord/action.yml +++ b/.forgejo/actions/push-status-to-discord/action.yml @@ -11,6 +11,7 @@ inputs: message-id: description: "Message ID to edit." + outputs: message-id: description: "ID of the message that was posted, for editing purposes in further calls." @@ -23,8 +24,22 @@ runs: uses: actions/setup-python@v5 with: python-version: 3.12 + - uses: actions/download-artifact@v3 + with: + name: "${{ github.sha }}-${{github.run_number}}-discord-context.zip" + path: /tmp + - id: set-context + run: | + echo "message-id=$(cat /tmp/discord-context)" >> $GITHUB_OUTPUT - name: Install dependencies + if: ${{ always() }} run: pip install -r ./.forgejo/actions/push-status-to-discord/requirements.txt - id: post-message run: | - echo "message-id=$(python ./.forgejo/actions/push-status-to-discord/main.py ${{ inputs.webhook-url }} ${{ inputs.project-name }} ${{ inputs.status }} ${{ inputs.message-id }})" >> $GITHUB_OUTPUT + echo "message-id=$(python ./.forgejo/actions/push-status-to-discord/main.py ${{ inputs.webhook-url }} ${{ inputs.project-name }} ${{ inputs.status }} ${{ steps.set-context.outputs.message-id }})" >> discord-context + - uses: actions/upload-artifact@v3 + with: + path: ./discord-context + name: "${{ github.sha }}-${{ github.run_number }}-discord-context.zip" + retention-days: 1 + overwrite: true diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index b2f532e..15d3a67 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -12,12 +12,6 @@ jobs: webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} project-name: ${{ github.repository }} status: "Started" - - run: echo ${{ steps.post-status.outputs.message-id }} >> discord-context - - uses: actions/upload-artifact@v3 - with: - path: ./discord-context - name: "${{ github.sha }}-${{ github.run_number }}-discord-context.zip" - retention-days: 1 sast: runs-on: ubuntu-latest steps: @@ -34,16 +28,8 @@ jobs: if: always() steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 - with: - name: "${{ github.sha }}-${{github.run_number}}-discord-context.zip" - path: /tmp - - id: set-context - run: | - echo "message-id=$(cat /tmp/discord-context)" >> $GITHUB_OUTPUT - uses: ./.forgejo/actions/push-status-to-discord with: webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} project-name: ${{ github.repository }} status: "Success" - message-id: ${{ steps.set-context.outputs.message-id }}