Add actionlint pre-commit hook for workflow validation (#49)
All checks were successful
Test CI / test (push) Successful in 0s

## Summary
- Fix workflow to use `github.*` context variables (Forgejo schema validator only recognizes GitHub Actions syntax, not `gitea.*` aliases)
- Pass untrusted inputs through environment variables (security best practice per actionlint)
- Add actionlint to Brewfile and pre-commit config to catch workflow validation errors locally

## Deployment and Testing
- [x] Pre-commit hooks all pass
- [x] actionlint validates `.forgejo/workflows/test.yaml` successfully
- [ ] Verify workflow runs without errors on Forge after merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: https://forge.tail8d86e.ts.net/eblume/blumeops/pulls/49
This commit is contained in:
Erich Blume 2026-01-23 17:56:24 -08:00
commit 3bcad4189f
3 changed files with 17 additions and 5 deletions

View file

@ -13,17 +13,21 @@ jobs:
- name: Checkout (git clone) - name: Checkout (git clone)
run: | run: |
# For PRs use head_ref (branch name), for pushes use ref_name # For PRs use head_ref (branch name), for pushes use ref_name
BRANCH="${{ gitea.head_ref || gitea.ref_name }}" BRANCH="${HEAD_REF:-$REF_NAME}"
git clone --depth 1 --branch "$BRANCH" \ git clone --depth 1 --branch "$BRANCH" \
"${{ gitea.server_url }}/${{ gitea.repository }}.git" . "${SERVER_URL}/${REPOSITORY}.git" .
env: env:
GIT_SSL_NO_VERIFY: "true" GIT_SSL_NO_VERIFY: "true"
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
- name: Hello World - name: Hello World
run: | run: |
echo "Hello from Forgejo Actions!" echo "Hello from Forgejo Actions!"
echo "Runner: $(hostname)" echo "Runner: $(hostname)"
echo "Repository: ${{ gitea.repository }}" echo "Repository: ${{ github.repository }}"
echo "Event: ${{ gitea.event_name }}" echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ gitea.ref }}" echo "Ref: ${{ github.ref }}"
ls -la ls -la

View file

@ -80,3 +80,10 @@ repos:
- id: prettier - id: prettier
types_or: [json] types_or: [json]
args: ['--tab-width', '2'] args: ['--tab-width', '2']
# GitHub/Forgejo Actions workflow linting
- repo: https://github.com/rhysd/actionlint
rev: v1.7.10
hooks:
- id: actionlint-system
files: ^\.forgejo/workflows/

View file

@ -1,4 +1,5 @@
# CLI tools for blumeops management # CLI tools for blumeops management
brew "actionlint" # GitHub/Forgejo Actions workflow linter
brew "argocd" # ArgoCD CLI for GitOps management brew "argocd" # ArgoCD CLI for GitOps management
brew "bat" # Syntax-highlighted file concatenation brew "bat" # Syntax-highlighted file concatenation
brew "tea" # Gitea/Forgejo CLI for forge.tail8d86e.ts.net brew "tea" # Gitea/Forgejo CLI for forge.tail8d86e.ts.net