A tiny Go CLI that submits links to Hacker News. It logs in with your credentials, reads the anti-CSRF fields off the submit form, and posts the story — handy for automating submissions on a schedule.
It ships three ways: as a GitHub Action, as a container image, and as a static binary.
name: ci
on:
workflow_dispatch:
inputs:
title:
description: The title of the link to submit.
required: true
url:
description: The URL of the link to submit.
required: true
verbose:
type: boolean
description: Verbose?
default: true
jobs:
submit-hackernews:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Submit link to Hacker News
uses: meysam81/submit-hackernews@v1
with:
username: ${{ secrets.HACKERNEWS_USERNAME }}
password: ${{ secrets.HACKERNEWS_PASSWORD }}
title: ${{ github.event.inputs.title }}
url: ${{ github.event.inputs.url }}
verbose: ${{ github.event.inputs.verbose }}docker run \
--name submit-hackernews \
--rm \
-e "HACKERNEWS_USERNAME=your_username" \
-e "HACKERNEWS_PASSWORD=your_password" \
ghcr.io/meysam81/submit-hackernews:v1 \
-t "This is the title of submission" \
-u "https://example.com"Download a binary from the releases page, or build from source (see Development), then:
submit-hackernews \
--username your_username \
--password your_password \
--title "This is the title of submission" \
--url "https://example.com"Every flag has an environment-variable fallback, so the tool works equally well from a shell, a container, or a GitHub Action.
| Flag | Alias | Environment variable | Required | Description |
|---|---|---|---|---|
--title |
-t |
HACKERNEWS_TITLE |
yes | Title of the submission. |
--url |
-u |
HACKERNEWS_URL |
yes | URL of the submission. |
--username |
-U |
HACKERNEWS_USERNAME |
yes | Hacker News username. |
--password |
-p |
HACKERNEWS_PASSWORD |
yes | Hacker News password. |
--verbose |
VERBOSE |
no | Enable verbose logging (request/response details). |
Requires Go (see go.mod for the version).
go build ./... # build
go test -race -count=1 ./... # test
go vet ./... # vet
gofmt -l . # format check