Skip to content

Validate Workflow YAML

POST /api/v8/repos/{owner}/{repo}/actions/workflows/validate

Call this endpoint to validate the workflow YAML.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace that owns the repository (organization or personal address path)
repo path string Yes Repository path (path)
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object containing one required field, base64_content:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "base64_content": {
      "description": "Content of the YAML file; must be base64-encoded",
      "type": "string"
    }
  },
  "required": ["base64_content"]
}

Response parameters

Field Type Always returned Nullable Description
valid boolean Yes No Validation result
diagnostics object[] Yes No Failure reason

diagnostics object

Field Type Always returned Nullable Description
diagnostics.range object Yes No Error location range
diagnostics.severity string No Yes Severity
diagnostics.message string No Yes Error message

diagnostics.range object

Field Type Always returned Nullable Description
diagnostics.range.start object Yes No Error start position
diagnostics.range.end object Yes No Error end position

diagnostics.range.start object

Field Type Always returned Nullable Description
diagnostics.range.start.line integer Yes No Start line number
diagnostics.range.start.column integer Yes No Start column number

diagnostics.range.end object

Field Type Always returned Nullable Description
diagnostics.range.end.line integer Yes No End line number
diagnostics.range.end.column integer Yes No End column number

Error responses

This endpoint has no documented business failure response. The following are only generic failure forms that the framework/gateway layer may return. The error field names returned by the backend take precedence.

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "The base64_content parameter cannot be empty"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP response status codes

Status code Description
200 Success (OK)
400 Invalid parameters or the request could not be parsed
401 Requires authentication
403 Forbidden
404 The request path does not exist
500 Internal server error

Request example

Parameter notes

<owner> is replaced with the address path of the namespace that owns the repository (organization or personal address path); <repo> is replaced with the repository path (path); <token> is replaced with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/workflows/validate?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"base64_content":"bmFtZTogdGVzdA=="}'

JavaScript

// Native fetch (Node.js 18+ / browser)
const token = "<YOUR-TOKEN>";
const base64Content = btoa("name: test");

const response = await fetch(
  `https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/workflows/validate?access_token=${token}`,
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Accept": "application/json",
    },
    body: JSON.stringify({ base64_content: base64Content }),
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/workflows/validate",
    params={"access_token": "<YOUR-TOKEN>"},
    json={"base64_content": "bmFtZTogdGVzdA=="},
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "valid": true,
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 1,
          "column": 1
        },
        "end": {
          "line": 1,
          "column": 5
        }
      },
      "severity": "error",
      "message": "syntax error"
    }
  ]
}

Error codes

Error code Description
400 Invalid parameters or the request could not be parsed
401 Unauthenticated or invalid credentials (missing or invalid access token)
403 Forbidden
404 The request path does not exist
429 Too many requests; rate limit triggered
500 Internal server error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc