mastodon-github-action
mastodon-github-action copied to clipboard
Missing protocol scheme
Hello 👋
we are currently getting an error: Error posting status: API call error: Post "/api/v1/statuses": unsupported protocol scheme ""
This error just started to happen about 2 Weeks ago. Last working job: https://github.com/patchlevel/event-sourcing/actions/runs/8687870377/job/23822282907 First failed job: https://github.com/patchlevel/event-sourcing/actions/runs/8734750142/job/23966065700
Between these 2 jobs the version was upgraded from v1 to v2. But i could find any BC-Break notices.
Worfklow file:
mastadon:
runs-on: ubuntu-latest
steps:
- uses: cbrgm/mastodon-github-action@v2
if: ${{ !github.event.repository.private }}
with:
message: "New ${{ github.event.repository.name }} release ${{ github.event.release.tag_name }}! ${{ github.event.release.html_url }}"
env:
MASTODON_URL: ${{ secrets.MASTODON_URL }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
I already re-checked the MASTODON_URL
and this is https://phpc.social
. And i also saw this issue here https://github.com/cbrgm/mastodon-github-action/issues/55 which suggest adding inheriting secret which seems not to be needed for our case, right?
I also saw another tool having the same problem: https://github.com/phpstan/phpstan-webmozart-assert/issues/180
Hi there @DanielBadura,
I'm sorry this causes you troubles. I believe the issue is that your MASTODON_URL
is missing a https://
(e.g. https://mastodon.social
) prefix, that's why the error occurs. #55 had the same issues.
The previous v1
version was written in Typescript and v2
is a rewrite in Go. Go's http
package is more strict about url names. :-)
I think you misunderstood me. I already re-checked the MASTODON_URL
and re-set it with the value https://phpc.social
but it still results in this error.
Got it. I'm checking what's wrong there, my assumption is I did a mistake parsing the environment variables the right way.
The environment variable parsing is fixed in v2.1.0 (https://github.com/cbrgm/mastodon-github-action/pull/61/files). The issue is not solved yet sadly. When I run
podman run -e MASTODON_ACCESS_TOKEN="..." -e MASTODON_URL="https://mastodon.social" -e MASTODON_MESSAGE="Test Message" --rm -it ghcr.io/cbrgm/mastodon-github-action:v2
locally everything works as expected and I'm able to publish a message to Mastodon. But when I run the latest version in a workflow for some reason the secret values passed as environment variables to the container are somehow removed by GitHub (for security reasons?) (see: https://github.com/cbrgm/mastodon-github-action/actions/runs/9015989932/job/24771686465) .
That's pretty weird, there must be something happening when GitHub passes the environment variables defined in a workflow file to the container during the workflow run. The environment variables are basically there but the value is empty e.g. ""
, that's why the unsupported protocol error message pops up. I'd have to look into that why that's the case.
In case this is blocking you, please just pass the URL and the Access Token as arguments to the action, this works fine @DanielBadura .
- name: Send toot to Mastodon
id: mastodon
uses: cbrgm/mastodon-github-action@v2
with:
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} # access token
url: ${{ secrets.MASTODON_URL }} # https://example.social
message: "Hello from GitHub Actions!"
The environment variable parsing is fixed in v2.1.0 (https://github.com/cbrgm/mastodon-github-action/pull/61/files). The issue is not solved yet sadly. When I run
podman run -e MASTODON_ACCESS_TOKEN="..." -e MASTODON_URL="https://mastodon.social" -e MASTODON_MESSAGE="Test Message" --rm -it ghcr.io/cbrgm/mastodon-github-action:v2
locally everything works as expected and I'm able to publish a message to Mastodon. But when I run the latest version in a workflow for some reason the secret values passed as environment variables to the container are somehow removed by GitHub (for security reasons?) (see: https://github.com/cbrgm/mastodon-github-action/actions/runs/9015989932/job/24771686465) .
That's pretty weird, there must be something happening when GitHub passes the environment variables defined in a workflow file to the container during the workflow run. The environment variables are basically there but the value is empty e.g. ""
, that's why the unsupported protocol error message pops up. I'd have to look into that why that's the case.
In case this is blocking you, please just pass the URL and the Access Token as arguments to the action, this works fine @DanielBadura .
- name: Send toot to Mastodon
id: mastodon
uses: cbrgm/mastodon-github-action@v2
with:
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} # access token
url: ${{ secrets.MASTODON_URL }} # https://example.social
message: "Hello from GitHub Actions!"
This issue is idle because it has been open for 90 days with no activity.
This issue is idle because it has been open for 90 days with no activity.
I think this can be closed :)
I think this can be closed :)
It still doesn't work for me.
It still doesn't work for me.
You mean with the env variables, right? I changed it from that to passing the variables directly. This is working for me and i saw the docs for v2 are using this variant instead, thats why I thought the issue can be closed.
Passing env variables hasn't been completely removed as https://github.com/cbrgm/mastodon-github-action/pull/61 suggests.
There hasn't been anything about removing support for env variables in 2.0.0 release notes: https://github.com/cbrgm/mastodon-github-action/releases/tag/v2.0.0
Since it's still supported but broken, I think this issue should be reopened. I have about 14 repositories at https://github.com/phpstan/ tooting releases to Mastodon and I want to avoid updating them to action inputs instead of env variables.