Skip to content

Commit a70034f

Browse files
committed
Allow auto proto conversion in forks
1 parent 83bf2b4 commit a70034f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/convert-proto.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ on:
2828
jobs:
2929
auto-proto-convert:
3030
runs-on: ubuntu-latest
31+
permissions:
32+
actions: read
33+
contents: read
3134
steps:
3235
- name: Checkout Repository
3336
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -55,6 +58,12 @@ jobs:
5558
exit 1
5659
fi
5760
61+
# repository_dispatch currently supplies GitHub's artifact page URL. That
62+
# URL is intended for browsers; use the REST API endpoint that returns the ZIP.
63+
if [[ "$ARTIFACT_DOWNLOAD_URL" =~ ^https://github\.com/([^/]+)/([^/]+)/actions/runs/[0-9]+/artifacts/([0-9]+)/?$ ]]; then
64+
ARTIFACT_DOWNLOAD_URL="https://api.github.com/repos/${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/actions/artifacts/${BASH_REMATCH[3]}/zip"
65+
fi
66+
5867
echo "artifact_download_url=$ARTIFACT_DOWNLOAD_URL" >> "$GITHUB_OUTPUT"
5968
echo "source_commit=${API_SPEC_COMMIT:-unknown}" >> "$GITHUB_OUTPUT"
6069
echo "run_id=${API_SPEC_RUN_ID:-unknown}" >> "$GITHUB_OUTPUT"
@@ -63,7 +72,7 @@ jobs:
6372
env:
6473
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6574
run: |
66-
curl -L \
75+
curl --fail --location --show-error \
6776
-H "Authorization: Bearer $GH_TOKEN" \
6877
-H "Accept: application/vnd.github+json" \
6978
-o api-spec-build.zip \

0 commit comments

Comments
 (0)