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

fix: fix parsing arguments as environment variables #61

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/example-workflow-envs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Send Mastodon Message (Environment Variables)

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Send toot to Mastodon
id: mastodon
uses: cbrgm/mastodon-github-action@main
with:
message: "Hello from GitHub Actions!"
visibility: "private" # default: public
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} # access token
MASTODON_URL: ${{ secrets.MASTODON_URL }} # https://example.social
16 changes: 8 additions & 8 deletions cmd/mastodon-github-action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ type MastodonStatus struct {

// ActionInputs collects all user inputs required for posting a status.
type ActionInputs struct {
URL string `arg:"--url,required" env:"MASTODON_URL"` // Mastodon instance URL.
AccessToken string `arg:"--access-token,required" env:"MASTODON_ACCESS_TOKEN"` // User access token for authentication.
Message string `arg:"--message,required" env:"MASTODON_MESSAGE"` // The status message content.
Visibility string `arg:"--visibility" env:"MASTODON_VISIBILITY"` // Visibility of the status.
Sensitive bool `arg:"--sensitive" env:"MASTODON_SENSITIVE"` // Flag to mark status as sensitive.
SpoilerText string `arg:"--spoiler-text" env:"MASTODON_SPOILER_TEXT"` // Additional content warning text.
Language string `arg:"--language" env:"MASTODON_LANGUAGE"` // Language of the status.
ScheduledAt string `arg:"--scheduled-at" env:"MASTODON_SCHEDULED_AT"` // Time to schedule the status.
URL string `arg:"--url,required, env:MASTODON_URL"` // Mastodon instance URL.
AccessToken string `arg:"--access-token,required, env:MASTODON_ACCESS_TOKEN"` // User access token for authentication.
Message string `arg:"--message,required, env:MASTODON_MESSAGE"` // The status message content.
Visibility string `arg:"--visibility, env:MASTODON_VISIBILITY"` // Visibility of the status.
Sensitive bool `arg:"--sensitive, env:MASTODON_SENSITIVE"` // Flag to mark status as sensitive.
SpoilerText string `arg:"--spoiler-text, env:MASTODON_SPOILER_TEXT"` // Additional content warning text.
Language string `arg:"--language, env:MASTODON_LANGUAGE"` // Language of the status.
ScheduledAt string `arg:"--scheduled-at, env:MASTODON_SCHEDULED_AT"` // Time to schedule the status.
}

// StatusResponse models the response returned by Mastodon after posting a status.
Expand Down