hashicorp/packer · error

GITHUB_ACTIONS environment variable not found

Error message

GITHUB_ACTIONS environment variable not found

What it means

Probe result from the GitHub Actions CI detector (GithubActions.Detect): the GITHUB_ACTIONS env var is absent, so the current process is not running inside GitHub Actions and this metadata provider does not apply.

Source

Thrown at internal/hcp/registry/metadata/cicd.go:16

// Copyright IBM Corp. 2024, 2026
// SPDX-License-Identifier: BUSL-1.1

package metadata

import (
	"fmt"
	"os"
)

type GithubActions struct{}

func (g *GithubActions) Detect() error {
	_, ok := os.LookupEnv("GITHUB_ACTIONS")
	if !ok {
		return fmt.Errorf("GITHUB_ACTIONS environment variable not found")
	}
	return nil
}

func (g *GithubActions) Details() map[string]interface{} {
	env := make(map[string]interface{})
	keys := []string{
		"GITHUB_REPOSITORY",
		"GITHUB_REPOSITORY_ID",
		"GITHUB_WORKFLOW_URL",
		"GITHUB_SHA",
		"GITHUB_REF",
		"GITHUB_ACTOR",
		"GITHUB_ACTOR_ID",
		"GITHUB_TRIGGERING_ACTOR",
		"GITHUB_EVENT_NAME",
		"GITHUB_JOB",
	}

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. This is an expected negative detection; the caller should try the next CI provider detector
  2. If you expect GitHub Actions, run the build inside a GitHub workflow runner
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/hcp/registry/metadata/cicd.go:16 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/540fa98e6b0d4187. Report an issue: GitHub.