Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing protocol scheme #60

Closed
DanielBadura opened this issue Apr 29, 2024 · 11 comments
Closed

Missing protocol scheme #60

DanielBadura opened this issue Apr 29, 2024 · 11 comments
Labels

Comments

@DanielBadura
Copy link

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 #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: phpstan/phpstan-webmozart-assert#180

@cbrgm
Copy link
Owner

cbrgm commented May 8, 2024

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.

@cbrgm
Copy link
Owner

cbrgm commented May 8, 2024

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. :-)

@DanielBadura
Copy link
Author

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.

@cbrgm
Copy link
Owner

cbrgm commented May 9, 2024

Got it. I'm checking what's wrong there, my assumption is I did a mistake parsing the environment variables the right way.

@cbrgm
Copy link
Owner

cbrgm commented May 9, 2024

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!"

DanielBadura added a commit to patchlevel/event-sourcing that referenced this issue May 10, 2024
ondrejmirtes added a commit to phpstan/phpstan that referenced this issue May 15, 2024
Copy link

github-actions bot commented Aug 8, 2024

This issue is idle because it has been open for 90 days with no activity.

@github-actions github-actions bot added the idle label Aug 8, 2024
@DanielBadura
Copy link
Author

I think this can be closed :)

@ondrejmirtes
Copy link

It still doesn't work for me.

@DanielBadura
Copy link
Author

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.

@ondrejmirtes
Copy link

Passing env variables hasn't been completely removed as #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.

@DanielBadura DanielBadura reopened this Aug 8, 2024
@github-actions github-actions bot removed the idle label Aug 9, 2024
Copy link

github-actions bot commented Nov 7, 2024

This issue is idle because it has been open for 90 days with no activity.

@github-actions github-actions bot added the idle label Nov 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants