Skip to content

feat: add the packagist action for the release workflow - #4

Merged
michal-giergielewicz merged 1 commit into
mainfrom
feat/packagist-action
Nov 15, 2026
Merged

michal-giergielewicz merged 1 commit into
mainfrom
feat/packagist-action

Conversation

@michal-giergielewicz

Copy link
Copy Markdown
Contributor

Summary

Rule: only the release workflow calls packagist.org; a repo has no Packagist webhook.

A Packagist webhook fires on each push, so packagist.org lists each PR branch as a dev-<branch> version. This change adds the pieces that replace the webhook:

  • actions/packagist: calls POST https://packagist.org/api/update-package with a Bearer header. It fails when an input is empty or when packagist.org does not answer with HTTP 2xx.
  • templates/packagist.yml: the job for the release workflow of a Composer package. It runs after each push to main, so packagist.org reads the new tag and dev-main.
  • README: the rule, step 6 of "Use in a repo", and the organization variable PACKAGIST_USERNAME and secret PACKAGIST_API_TOKEN (the SAFE token).

Test evidence

  • The script of the action with empty inputs: exit 1 with the error message.
  • The script with a false token against packagist.org: HTTP 403, exit 1.
  • actionlint: exit 0.
  • python3 -I -m unittest discover -s tests: 20 tests, OK.
  • Not tested here: a call with a valid token. The first Release run of a repo that uses the job shows it.

Release impact

.github: minor (feat:), 2.0.0 → 2.1.0. No existing action changes.

Risk and rollback

No repo uses the new action until it adds the job. Rollback: revert this PR.

The action asks packagist.org to update the package of the repo. A repo
calls it from the Release workflow only and has no Packagist webhook, so
a push to a PR branch never reaches packagist.org.

The template templates/packagist.yml holds the job, and the README
states the rule and the organization variable and secret.
@michal-giergielewicz
michal-giergielewicz enabled auto-merge (squash) November 15, 2026 21:11
@michal-giergielewicz
michal-giergielewicz merged commit 93b8d0f into main Nov 15, 2026
6 checks passed
@michal-giergielewicz
michal-giergielewicz deleted the feat/packagist-action branch November 15, 2026 21:12
michal-giergielewicz added a commit to freyr/monadic that referenced this pull request Nov 15, 2026
## Summary

Only the release workflow calls packagist.org (rule of `freyr/.github`
v2.1.0). The new job `packagist` runs after each push to `main` and
after a manual release. The Packagist webhook of the repo is removed
after the first good run, so a push to a pull request branch no longer
makes a `dev-<branch>` version on packagist.org.

## Test evidence

- `actionlint`: exit 0.
- The action itself: see freyr/.github#4.
- The first Release run on `main` after the merge shows the call with
the real token.

## Release impact

None (`ci:`).

## Risk and rollback

The job needs the organization secret `PACKAGIST_API_TOKEN`. Without it
the job fails with a clear message, and the release job itself is not
affected. Rollback: revert this pull request and add the webhook again.
michal-giergielewicz added a commit to freyr/identity that referenced this pull request Nov 15, 2026
## Summary

Only the release workflow calls packagist.org (rule of `freyr/.github`
v2.1.0). The new job `packagist` runs after each push to `main` and
after a manual release. The Packagist webhook of the repo is removed
after the first good run, so a push to a pull request branch no longer
makes a `dev-<branch>` version on packagist.org.

## Test evidence

- `actionlint`: exit 0.
- The action itself: see freyr/.github#4.
- The first Release run on `main` after the merge shows the call with
the real token.

## Release impact

None (`ci:`).

## Risk and rollback

The job needs the organization secret `PACKAGIST_API_TOKEN`. Without it
the job fails with a clear message, and the release job itself is not
affected. Rollback: revert this pull request and add the webhook again.
michal-giergielewicz added a commit to freyr/message-broker that referenced this pull request Nov 15, 2026
## Summary

Only the release workflow calls packagist.org (rule of `freyr/.github`
v2.1.0). The new job `packagist` runs after each push to `main` and
after a manual release. The Packagist webhook of the repo is removed
after the first good run, so a push to a pull request branch no longer
makes a `dev-<branch>` version on packagist.org.

## Test evidence

- `actionlint`: exit 0.
- The action itself: see freyr/.github#4.
- The first Release run on `main` after the merge shows the call with
the real token.

## Release impact

None (`ci:`).

## Risk and rollback

The job needs the organization secret `PACKAGIST_API_TOKEN`. Without it
the job fails with a clear message, and the release job itself is not
affected. Rollback: revert this pull request and add the webhook again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant