canonical / canonical/webteam-devops
Charm pack check assumes the `github.before` context
- Dominant language
- HCL
- Stars
- 3
- Forks
- 0
- Avg merge
- 6h 53m
- Merged PRs (30d)
- 8
Description
The deploy workflow assumes that the `github.before` commit signature is available.
https://github.com/canonical/webteam-devops/blob/285865893f8ace88e012a0f216f0b2827a18d488/.github/workflows/deploy.yaml#L39-L43
However, this is only available for some workflow triggers.
From the [GitHub docs](https://docs.github.com/en/actions/reference/accessing-contextual-information-about-workflow-runs#github-context) on the `github` context:
> The full event webhook payload. You can access individual properties of the event using this context. This object is identical to the webhook payload of the event that triggered the workflow run, and **is different for each event**.
This effectively restricts consuming workflows to using triggers that support the `github.before` context, which as far as I can tell is only [push](https://docs.github.com/en/webhooks/webhook-events-and-payloads#push).
See for example, [this workflow run](https://github.com/canonical/charmhub.io/actions/runs/15848871824/job/44677251161) that was triggered by a `workflow_dispatch`. The `git diff` command only receives one commit signature, because `github.before` is not available.
```
Run if git diff --name-only 2a5e6d005728f764f209f8b66d278354edaed0c4 | grep '^charm/'; then
warning: Not a git repository. Use --no-index to compare two paths outside a working tree
```
Not sure what the best way to go about solving this is. Maybe an input parameter could be exposed `PACK_CHARM` to allow the user custom control over whether or not to pack the charm.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.