Adding a warning in case of failed job
This commit is contained in:
29
action.yml
29
action.yml
@@ -64,17 +64,31 @@ runs:
|
|||||||
|
|
||||||
mv "${{ inputs.customArchiveName }}.tar.gz" ../
|
mv "${{ inputs.customArchiveName }}.tar.gz" ../
|
||||||
- name: Publishing App
|
- name: Publishing App
|
||||||
|
continue-on-error: true # Ensures the job shows a warning instead of failing
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
PKG_URL="${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/${{ inputs.appName }}/${{ inputs.version }}/${{ inputs.customArchiveName }}.tar.gz"
|
PKG_URL="${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/${{ inputs.appName }}/${{ inputs.version }}/${{ inputs.customArchiveName }}.tar.gz"
|
||||||
log_info "Sending package in $(yellow)${PKG_URL}"
|
log_info "Sending package in $(yellow)${PKG_URL}"
|
||||||
|
|
||||||
curl --user "MilaBot:${{ inputs.token }}" \
|
HTTP_RESPONSE=$(curl --user "MilaBot:${{ inputs.token }}" \
|
||||||
--upload-file "${{ inputs.customArchiveName }}.tar.gz" \
|
--upload-file "${{ inputs.customArchiveName }}.tar.gz" \
|
||||||
"${PKG_URL}" \
|
"${PKG_URL}" \
|
||||||
--progress-bar \
|
--progress-bar \
|
||||||
--show-error \
|
--show-error \
|
||||||
--fail
|
--fail --silent --write-out "%{http_code}" --output /dev/null)
|
||||||
|
|
||||||
|
if [[ "$HTTP_RESPONSE" == "409" ]]; then
|
||||||
|
log_info "⚠️ Warning: File already exists (HTTP 409). Ignoring failure."
|
||||||
|
exit 1 # Step "fails", but job stays in warning state due to continue-on-error
|
||||||
|
elif [[ "$HTTP_RESPONSE" -ge 200 && "$HTTP_RESPONSE" -lt 300 ]]; then
|
||||||
|
log_info "✅ Upload successful."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "HTTP_RESPONSE=$HTTP_RESPONSE" >> "$GITEA_ENV"
|
||||||
|
|
||||||
|
log_info "❌ Error: HTTP response $HTTP_RESPONSE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
PKG_SHA="$(sha256sum "${{ inputs.customArchiveName }}.tar.gz" | cut -d' ' -f1 | tr -d '\n')"
|
PKG_SHA="$(sha256sum "${{ inputs.customArchiveName }}.tar.gz" | cut -d' ' -f1 | tr -d '\n')"
|
||||||
log_info "Exporting package sha256 hash in env var $(yellow)PKG_SHA"
|
log_info "Exporting package sha256 hash in env var $(yellow)PKG_SHA"
|
||||||
@@ -85,3 +99,6 @@ runs:
|
|||||||
|
|
||||||
log_info "Cleaning up"
|
log_info "Cleaning up"
|
||||||
rm -f "${{ inputs.customArchiveName }}.tar.gz"
|
rm -f "${{ inputs.customArchiveName }}.tar.gz"
|
||||||
|
- name: Validate job
|
||||||
|
shell: bash
|
||||||
|
run: [[ -z "$HTTP_RESPONSE" ]]; || exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user