Unverified Commit e8512b31 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

fix(CI): Don't require the GRAPHITE_TOKEN secret, as it's not available in forks (#69517)

> With the exception of `GITHUB_TOKEN`, secrets are not passed to the
runner when a workflow is triggered from a forked repository.

--
https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow

## Test plan

Make a PR from a fork: #69518

Check the actions log and make sure it behaves as expected (fails open,
runs all tests):

<img width="1121" alt="Screenshot 2024-08-30 at 3 46 27 PM"
src="https://github.com/user-attachments/assets/e9ba7629-61da-431f-9822-8833dbb497b3">
<img width="309" alt="Screenshot 2024-08-30 at 3 46 35 PM"
src="https://github.com/user-attachments/assets/4d7d4cb0-ce2e-4cdd-bbdb-90de1347a77b">
parent a0858483
...@@ -20,8 +20,12 @@ on: ...@@ -20,8 +20,12 @@ on:
secrets: secrets:
GRAPHITE_TOKEN: GRAPHITE_TOKEN:
description: 'The Graphite CI optimization secret' description: 'The Graphite CI optimization secret'
required: true # secrets are not available in forks, check-skip will just fail-open with a warning
required: false
env: env:
# FYI, if you add this label, you must *push* to the repository again to trigger a new event. Just
# re-running in the GitHub actions UI won't work, as it will re-use the old event with the old
# labels.
HAS_BYPASS_LABEL: |- HAS_BYPASS_LABEL: |-
${{ ${{
github.event_name == 'pull_request' && github.event_name == 'pull_request' &&
...@@ -42,5 +46,6 @@ jobs: ...@@ -42,5 +46,6 @@ jobs:
- name: Debug Output - name: Debug Output
run: | run: |
echo 'github.event_name: ${{ github.event_name }}' echo 'github.event_name: ${{ github.event_name }}'
echo "secrets.GRAPHITE_TOKEN != '': ${{ secrets.GRAPHITE_TOKEN != '' }}"
echo 'env.HAS_BYPASS_LABEL: ${{ env.HAS_BYPASS_LABEL }}' echo 'env.HAS_BYPASS_LABEL: ${{ env.HAS_BYPASS_LABEL }}'
echo 'steps.check-skip.outputs.skip: ${{ steps.check-skip.outputs.skip }}' echo 'steps.check-skip.outputs.skip: ${{ steps.check-skip.outputs.skip }}'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment