From 75afc4c4b8a14a5cef76adb4c812fda8cca251d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Rudowicz?= Date: Tue, 25 Feb 2025 20:23:46 +0100 Subject: [PATCH] one step forward, one step back --- .forgejo/workflows/test_workflow.yml | 4 ++-- upload-artifact/action.yml | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/test_workflow.yml b/.forgejo/workflows/test_workflow.yml index efe6bab..8688c49 100644 --- a/.forgejo/workflows/test_workflow.yml +++ b/.forgejo/workflows/test_workflow.yml @@ -6,7 +6,7 @@ jobs: container: image: git.hswro.org/fleg/actions-experiments:latest steps: - - uses: https://codeberg.org/fleg/light-actions/checkout@test9 + - uses: https://codeberg.org/fleg/light-actions/checkout@test10 - run: cat README.md upload-artifact: runs-on: docker @@ -14,7 +14,7 @@ jobs: image: git.hswro.org/fleg/actions-experiments:latest steps: - run: echo "test passed" > test.txt - - uses: https://codeberg.org/fleg/light-actions/upload-artifact@test9 + - uses: https://codeberg.org/fleg/light-actions/upload-artifact@test10 with: path: test.txt artifact-name: test-artifact diff --git a/upload-artifact/action.yml b/upload-artifact/action.yml index 7b31a92..52f357f 100644 --- a/upload-artifact/action.yml +++ b/upload-artifact/action.yml @@ -13,6 +13,8 @@ runs: - run: | set -euxo pipefail ARTIFACT_BASE="${ACTIONS_RUNTIME_URL}_apis/pipelines/workflows/${GITHUB_RUN_ID}/artifacts?api-version=6.0-preview" + FILE_SIZE_BYTES=$(wc -c < ${{ inputs.path }}) + FILE_SIZE_BYTES_MINUS_ONE=$(echo $FILE_SIZE_BYTES - 1 | bc) RESOURCE_URL="$( curl \ -XPOST \ @@ -22,7 +24,7 @@ runs: --header 'Accept: application/json;api-version=6.0-preview' \ --header 'Content-Type: application/json' \ --data '{"type": "actions_storage", "name": "${{ inputs.artifact-name }}"}' \ - $ARTIFACT_BASE | tee /dev/stderr | jq --exit-status --raw-output .fileContainerResourceUrl + $ARTIFACT_BASE | tee /dev/stderr | jq --exit-status --raw-output .fileContainerResourceUrl \2 )" curl \ @@ -30,9 +32,9 @@ runs: --silent \ --fail-with-body \ --header 'Accept: application/json;api-version=6.0-preview' \ - --header \"Authorization: Bearer ${GITHUB_TOKEN}\" \ + --header "Authorization: Bearer ${{ github.token }}" \ --header 'Content-Type: application/octet-stream' \ - --header "Content-Range: bytes 0-$(echo \"$(wc -c < ${{ inputs.path }}) - 1 | wc")/$(wc -c < ${{ inputs.path }})" \ + --header "Content-Range: bytes 0-${FILE_SIZE_BYTES_MINUS_ONE}/${FILE_SIZE_BYTES}" \ --data-binary "@${{ inputs.path }}" \ "${RESOURCE_URL}?itemPath=${{ inputs.artifact-name }}/$(basename ${{ inputs.path }})" @@ -41,8 +43,8 @@ runs: --silent \ --fail-with-body \ --header 'Accept: application/json;api-version=6.0-preview' \ - --header \"Authorization: Bearer ${GITHUB_TOKEN}\" \ + --header "Authorization: Bearer ${{ github.token }}" \ --header 'Content-Type: application/json' \ - --data '{"size": 11}' \ + --data '{"size": ${FILE_SIZE_BYTES}}' \ "${ARTIFACT_BASE}&artifactName=${{ inputs.artifact-name }}" shell: sh