Skip to content

Commit dbc7b0f

Browse files
committed
ci(ghcr): fix env variable access in cleanup workflow
Pass environment variables explicitly to github-script steps and hardcode package type to ensure proper script execution context.
1 parent 475ee56 commit dbc7b0f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/cleanup-ghcr-images.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
packages: write
2020

2121
env:
22-
PACKAGE_TYPE: container
2322
PACKAGE_NAME: opencode-cli
2423
RETENTION_DAYS: ${{ inputs.retention_days || vars.GHCR_RETENTION_DAYS || '45' }}
2524
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
@@ -30,10 +29,14 @@ jobs:
3029
steps:
3130
- name: Delete old container versions but keep one
3231
uses: actions/github-script@v8
32+
env:
33+
PACKAGE_NAME: ${{ env.PACKAGE_NAME }}
34+
RETENTION_DAYS: ${{ env.RETENTION_DAYS }}
35+
DRY_RUN: ${{ env.DRY_RUN }}
3336
with:
3437
script: |
3538
const owner = context.repo.owner;
36-
const packageType = process.env.PACKAGE_TYPE;
39+
const packageType = 'container';
3740
const packageName = process.env.PACKAGE_NAME;
3841
const retentionDays = Number(process.env.RETENTION_DAYS);
3942
const dryRun = process.env.DRY_RUN === 'true';
@@ -135,10 +138,13 @@ jobs:
135138
steps:
136139
- name: Delete container versions that only have SHA tags
137140
uses: actions/github-script@v8
141+
env:
142+
PACKAGE_NAME: ${{ env.PACKAGE_NAME }}
143+
DRY_RUN: ${{ env.DRY_RUN }}
138144
with:
139145
script: |
140146
const owner = context.repo.owner;
141-
const packageType = process.env.PACKAGE_TYPE;
147+
const packageType = 'container';
142148
const packageName = process.env.PACKAGE_NAME;
143149
const dryRun = process.env.DRY_RUN === 'true';
144150

0 commit comments

Comments
 (0)