Skip to content

fix: read fresh PR state before policy assessment #37

fix: read fresh PR state before policy assessment

fix: read fresh PR state before policy assessment #37

Workflow file for this run

name: Image Minimizer

Check warning on line 1 in .github/workflows/image-minimizer.yml

View workflow run for this annotation

GitHub Actions / Image Minimizer

Workflow execution policy warning (evaluate mode)

On November 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
on:
workflow_call:
issue_comment:
types: [created, edited]
issues:
types: [opened, edited]
pull_request_target:
types: [opened, edited]
concurrency:
group: image-minimizer-${{ github.event_name }}-${{ github.event.comment.id || github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
jobs:
policy:
if: ${{ github.event_name == 'issues' || github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
steps:
- name: Checkout .github repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: FossifyOrg/.github
path: .github-repo
- id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Enforce contribution policy
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL: gpt-5.4
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const policy = require('./.github-repo/scripts/policy.cjs');
await policy({github, context, core});
minimize:
if: ${{ github.actor != 'fossifybot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Checkout .github repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: FossifyOrg/.github
path: .github-repo
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
with:
node-version: 16
- name: Install probe-image-size
run: npm i probe-image-size@7.2.3 --ignore-scripts
- id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Minimize simple images
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
timeout-minutes: 3
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const script = require('./.github-repo/scripts/image-minimizer.cjs');
await script({github, context});