Skip to content

resource-published

resource-published #16

name: Push Permissions
on:
repository_dispatch:
types:
- resource-published
- resource-unpublished
jobs:
debug:
runs-on: ubuntu-latest
steps:
- run: |
echo "Status: ${{ github.event.client_payload.status }}"
echo "Path: ${{ github.event.client_payload.path }}"
index_ingest:
if: (github.event.client_payload.status == 200 || github.event.client_payload.status == 204) && endsWith(github.event.client_payload.path, '.md')
runs-on: ubuntu-latest
steps:
# - name: Sleep for 90 seconds assuming query-index-search.json will be updated before
# run: sleep 90s
# shell: bash
- name: Remove .md extension
id: removeMd
uses: frabert/replace-string-action@v2
with:
pattern: '\.md$'
string: ${{ github.event.client_payload.path }}
replace-with: ''
- name: Find page JSON
id: findPageJson
run: |
pageSize=1
currentOffset=0
total=0
while [ -z "$role"] && [ "$currentOffset" -le "$total" ]
do
json=$(curl "https://main--envelop--netcentric.hlx.live/query-index.json?limit=$pageSize&offset=$currentOffset")
echo "json: $json"
total=$(echo "$json" | jq '.total')
echo "total: $total"
role=$(echo "$json" | jq '( .data[] | select(.path=="/page-no4") ) .role')
echo "role: '$role"
currentOffset=$(($currentOffset + $pageSize))
echo "currentOffset: $currentOffset"
done
echo "finished"
echo $json
echo $data
echo $role