File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Weekly Algolia Random Search
2
+
3
+ on :
4
+ schedule :
5
+ # Run at 00:00 UTC every Monday
6
+ - cron : ' 0 0 * * 1'
7
+ # Allow manual trigger for testing
8
+ workflow_dispatch :
9
+
10
+ jobs :
11
+ random-search :
12
+ runs-on : ubuntu-latest
13
+ env :
14
+ ALGOLIA_APP_ID : GF9WWVY2E3
15
+ ALGOLIA_API_KEY : b315dd81ad99d5a42d110b2b9252877f
16
+ ALGOLIA_INDEX_NAME : memospot-docs
17
+ ALGOLIA_SEARCHES : data,config
18
+
19
+ steps :
20
+ - name : Generate random search query
21
+ id : random-query
22
+ run : |
23
+ # Convert ALGOLIA_SEARCHES to array and pick random entry
24
+ IFS=',' read -ra SEARCHES <<< "$ALGOLIA_SEARCHES"
25
+ RANDOM_INDEX=$((RANDOM % ${#SEARCHES[@]}))
26
+ SEARCH_QUERY="${SEARCHES[$RANDOM_INDEX]}"
27
+ echo "query=$SEARCH_QUERY" >> $GITHUB_OUTPUT
28
+
29
+ - name : Perform Algolia search
30
+ run : |
31
+ curl -X POST \
32
+ "https://${ALGOLIA_APP_ID}-dsn.algolia.net/1/indexes/${ALGOLIA_INDEX_NAME}/query" \
33
+ -H "X-Algolia-API-Key: ${ALGOLIA_API_KEY}" \
34
+ -H "X-Algolia-Application-Id: ${ALGOLIA_APP_ID}" \
35
+ -H "Content-Type: application/json" \
36
+ --data-binary '{"params": "query=${{ steps.random-query.outputs.query }}"}' |
37
+ jq -r '.hits[].url'
You can’t perform that action at this time.
0 commit comments