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

Revert "Try to restore pic check action (pull PR number correctly)" #251

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/check_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_PR_NO: ${{ github.event.pull_request.number }}
GITHUB_REF: ${{ github.ref }}
run: |
python scripts/webp_conversion/check_images_in_pr.py

Expand Down
12 changes: 9 additions & 3 deletions scripts/webp_conversion/check_images_in_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
repo = g.get_repo(repo_name)

# Get the PR number from the GitHub event
pr_number = os.environ.get('GITHUB_PR_NO')
if not pr_number:
print("Error: GITHUB_PR_NO is not set.", file=sys.stderr)
pr_ref = os.environ.get('GITHUB_REF')
if not pr_ref:
print("Error: GITHUB_REF is not set.", file=sys.stderr)
sys.exit(1)

try:
pr_number = int(pr_ref.split('/')[-2])
except (IndexError, ValueError):
print("Error: Could not parse PR number from GITHUB_REF.", file=sys.stderr)
sys.exit(1)

pr = repo.get_pull(pr_number)
Expand Down
Loading