Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt to send screenshots to Pixel Eagle without a token #16655

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/send-screenshots-to-pixeleagle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,33 @@ on:
required: true
type: string

env:
# Unfortunately, we can't check secrets in `if:` conditionals. However, Github's own documentation
# suggests a workaround: Putting the secret in an environment variable, and checking that instead.
PIXELEAGLE_TOKEN_EXISTS: ${{ secrets.PIXELEAGLE_TOKEN != '' }}
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
send-to-pixel-eagle:
name: Send screenshots to Pixel Eagle
runs-on: ubuntu-24.04
# Pixel Eagle is irrelevant for most forks, even of those that allow workflows to run. Thus, we
# disable this job for any forks. Any forks where Pixel Eagle is relevant can comment out the
# `if:` conditional below.
if: ${{ github.repository == 'bevyengine/bevy' }}
steps:
- name: Notify user on non-existent token
if: ${{ ! fromJSON(env.PIXELEAGLE_TOKEN_EXISTS) }}
Copy link
Contributor Author

@LikeLakers2 LikeLakers2 Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you're curious:

  • Environment variables are stored as strings. However, the strings 'true' and 'false' are valid JSON, and return booleans when converted to JSON.
  • This if: has to be on the steps - an if: conditional on the job itself cannot access to environment variables for some reason.

LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
run: |
echo "The PIXELEAGLE_TOKEN secret does not exist, so uploading screenshots to Pixel Eagle was skipped." >> $GITHUB_STEP_SUMMARY

- name: Download artifact
if: ${{ fromJSON(env.PIXELEAGLE_TOKEN_EXISTS) }}
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.artifact }}

- name: Send to Pixel Eagle
if: ${{ fromJSON(env.PIXELEAGLE_TOKEN_EXISTS) }}
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
env:
project: B04F67C0-C054-4A6F-92EC-F599FEC2FD1D
run: |
Expand Down
Loading