canonical / canonical/operator-workflows

integration_test fails on pull_request_review events due to unauthorized GHCR package push

Open Beginner friendly
#1,038 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
12
Forks
27
Avg merge
2d 23h
Merged PRs (30d)
12

Description

### Bug Description

- When `upload-image` is not explicitly set, `fromFork()` checks `context.eventName === 'pull_request'`.
- When the workflow is triggered by `pull_request_review` (e.g. on approval in our [workflow example](https://github.com/canonical/kernelfactory.canonical.com/actions/runs/32028950313/job/95384522737?pr=586)), `context.eventName` is `'pull_request_review'`.
- `fromFork()` returns false, causing operator-workflows to default to registry (ghcr.io).
- In GitHub Actions, standard `GITHUB_TOKEN` credentials in workflow runs triggered by PR review events do not have permissions to write/create packages causing a message `denied: installation not allowed to Create organization package error.`

https://github.com/canonical/operator-workflows/blob/5ddf42a5a7133f29db743d8956c38646db736699/src/plan.ts#L22-L31

### Impact

Medium (functionality degraded, workaround exists)

### Impact Rationale

_No response_

### Link to the failing workflow

https://github.com/canonical/kernelfactory.canonical.com/actions/runs/32110091517/job/95627558080

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/plan.ts around lines 22-31 and inspect how fromFork() handles pull_request_review events. Reproduce or run the integration test using the linked workflow context, then verify that the workflow no longer attempts an unauthorized GHCR package push and that the integration test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.