Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pr-preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ jobs:

## Inputs

| Name | Required | Default | Description |
| ------------------ | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------- |
| `bee-url` | `false` | `https://api.gateway.ethswarm.org` | URL of Bee node |
| `bzz-link-url` | `false` | `https://<<CID>>.bzz.link` | URL of for Bzz.link |
| `postage-batch-id` | `false` | `0000000000000000000000000000000000000000000000000000000000000000` | Batch ID of Postage Stamp that will be used for upload |
| `dir` | `false` | `./build` | Path to build directory that should be uploaded. Default: ./build |
| `token` | `false` | `GITHUB_TOKEN` | Token to be used for creating the PR comment. Default: GITHUB_TOKEN |
| `headers` | `false` | - | Headers used for the HTTP call to bee |
| Name | Required | Default | Description |
| ------------------ | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `bee-url` | `false` | `https://api.gateway.ethswarm.org` | URL of Bee node |
| `bzz-link-url` | `false` | `https://<<CID>>.bzz.link` | URL of for Bzz.link |
| `postage-batch-id` | `false` | `0000000000000000000000000000000000000000000000000000000000000000` | Batch ID of Postage Stamp that will be used for upload |
| `dir` | `false` | `./build` | Path to build directory that should be uploaded. Default: ./build |
| `token` | `false` | `GITHUB_TOKEN` | Token to be used for creating the PR comment. Default: GITHUB_TOKEN |
| `headers` | `false` | - | Headers used for the HTTP call to bee |
| `index-document` | `false` | `index.html` if it exists | Default file to be returned when the root hash of collection is accessed |

## Outputs

Expand Down
22 changes: 22 additions & 0 deletions pr-preview/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ inputs:
description: 'Headers used for the HTTP call to bee'
required: false

index-document:
description: 'Default file to be returned when the root hash of collection is accessed. By default, index.html is set if the file exists.'
required: false
default: ''

outputs:
swarm-hash:
description: 'Swarm hash of the uploaded content'
Expand All @@ -46,6 +51,22 @@ outputs:
runs:
using: 'composite'
steps:
- id: index
name: Set index document
if: github.event_name == 'pull_request'
shell: bash
run: |
if [ "${{ inputs.index-document }}" = "false" ]
then
echo "::set-output name=document::"
elif [ ! -z "${{ inputs.index-document }}" ]
then
echo "::set-output name=document::${{ inputs.index-document }}"
elif [ -f "${{ inputs.dir }}/index.html" ]
then
echo "::set-output name=document::index.html"
fi

- id: upload
name: Upload to Swarm
if: github.event_name == 'pull_request'
Expand All @@ -55,6 +76,7 @@ runs:
postage-batch-id: ${{ inputs.postage-batch-id }}
dir: ${{ inputs.dir }}
headers: ${{ inputs.headers }}
index-document: ${{ steps.index.outputs.document }}

- id: cid
name: Convert reference to CID
Expand Down