refactor: pull artifact handling in action
This commit is contained in:
parent
7fdf2498a9
commit
35de43427b
2 changed files with 20 additions and 15 deletions
|
@ -10,6 +10,9 @@ inputs:
|
||||||
required: true
|
required: true
|
||||||
message-id:
|
message-id:
|
||||||
description: "Message ID to edit."
|
description: "Message ID to edit."
|
||||||
|
init:
|
||||||
|
description: "Marks the first status push, prevents pulling context."
|
||||||
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
message-id:
|
message-id:
|
||||||
|
@ -23,8 +26,23 @@ runs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.12
|
python-version: 3.12
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
if: ${{ !inputs.init }}
|
||||||
|
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
|
- name: Install dependencies
|
||||||
|
if: ${{ always() }}
|
||||||
run: pip install -r ./.forgejo/actions/push-status-to-discord/requirements.txt
|
run: pip install -r ./.forgejo/actions/push-status-to-discord/requirements.txt
|
||||||
- id: post-message
|
- id: post-message
|
||||||
run: |
|
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 "$(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
|
||||||
|
|
|
@ -12,12 +12,7 @@ jobs:
|
||||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
project-name: ${{ github.repository }}
|
project-name: ${{ github.repository }}
|
||||||
status: "Started"
|
status: "Started"
|
||||||
- run: echo ${{ steps.post-status.outputs.message-id }} >> discord-context
|
init: true
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
path: ./discord-context
|
|
||||||
name: "${{ github.sha }}-${{ github.run_number }}-discord-context.zip"
|
|
||||||
retention-days: 1
|
|
||||||
sast:
|
sast:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -34,16 +29,8 @@ jobs:
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- uses: ./.forgejo/actions/push-status-to-discord
|
||||||
with:
|
with:
|
||||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
project-name: ${{ github.repository }}
|
project-name: ${{ github.repository }}
|
||||||
status: "Success"
|
status: "Success"
|
||||||
message-id: ${{ steps.set-context.outputs.message-id }}
|
|
||||||
|
|
Loading…
Reference in a new issue