diff --git a/action.yml b/action.yml index 97868ca..2653b1f 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,15 @@ inputs: The name of the job running this action. If not set, no comparisons can be made. default: '' + private-repo-workaround: + description: | + Forgejo doesn't support downloading artifacts through the API [see + codeberg.org/forgejo/forgejo#6315](https://codeberg.org/forgejo/forgejo/issues/6315). + + As a workaround, checkout the base branch and regenerate the report. + + This is very innefficient T-T and slow. + default: 'false' outputs: runs: using: 'composite' @@ -65,6 +74,7 @@ runs: ARTIFACT_NAME: ${{ inputs.artifact-name }} HEAD_BRANCH: ${{ inputs.base-branch }} JOB_NAME: ${{ inputs.job-name }} + PRIVATE_REPO: ${{ inputs.private-repo-workaround }} run: | . "${GITHUB_ACTION_PATH}/utils.sh" @@ -87,8 +97,17 @@ runs: test "$http_code" = '200' } + if [ "$PRIVATE_REPO" = 'true' ]; then + log "In a private repo, switching to $HEAD_BRANCH to build the old report" + git switch "$HEAD_BRANCH" + + "$GITHUB_ACTION_PATH/create-report.sh" > old-report.json + + log "Reporting on sizes and comparing to sizes in $HEAD_BRANCH" + "$GITHUB_ACTION_PATH/comment_on_pr.sh" report.json old-report.json + exit 0 # If we have a previous report compare against it - if [ "$JOB_NAME" ] && [ "$HEAD_BRANCH" ]; then + elif [ "$JOB_NAME" ] && [ "$HEAD_BRANCH" ]; then url=$(base_report_url) log "Found previous run at: $url" report_url="$url/artifacts/$ARTIFACT_NAME"