Setup R2 Public Access #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Setup R2 Public Access | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Enable R2 Public Access | |
| env: | |
| CF_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: | | |
| set -x | |
| AID="6a46b418508c26278ae2d3373f41da81" | |
| # Try to enable public access on the bucket | |
| echo "=== Enable public access on acreetionos-isos ===" | |
| curl -s -X POST \ | |
| -H "Authorization: Bearer $CF_API_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| "https://api.cloudflare.com/client/v4/accounts/$AID/r2/buckets/acreetionos-isos/public-access" \ | |
| -d '{"enabled":true}' | jq . | |
| # List the existing acreetionos-32bit bucket to see if there are ISOs | |
| echo "=== Check existing 32bit bucket objects ===" | |
| curl -s -H "Authorization: Bearer $CF_API_TOKEN" \ | |
| "https://api.cloudflare.com/client/v4/accounts/$AID/r2/buckets/acreetionos-32bit/objects" | jq '.result.objects[:5] | .[]? | {key, size, uploaded}' 2>/dev/null || echo "No access" | |
| echo "=== Done ===" |