A GitHub Action that treats issue & pull request labels as a simple key-value store. Persist workflow state across jobs and events without external storage.
No database. No artifacts. Just labels with a structured naming convention.
Set the value of phase to build
- uses: FidelusAleksander/state-labels@v1
with:
operation: set
key: phase
value: buildThen get the value in the same, or different workflow run
- uses: FidelusAleksander/state-labels@v1
id: phase
with:
operation: get
key: phase
- name: Use value
run: echo "phase: ${{ steps.phase.outputs.value }}"
Labels are created using a structured format:
{prefix}{separator}{key}{separator}{value}Defaults to: state::key::value
On set, any existing label for the same {prefix}{separator}{key} is removed
first.
Only labels starting with the configured prefix are considered. Other repository labels remain untouched.
| Input | Description | Required | Default |
|---|---|---|---|
operation |
One of get, get-all, set, remove |
Yes | - |
issue-number |
Issue or PR number to operate on (auto-detected from context if not provided) | No | - |
key |
State key (needed for get, set, remove) |
No | - |
value |
State value (needed for set) |
No | - |
prefix |
Label prefix | No | state |
separator |
Separator between prefix, key, value | No | :: |
repository |
Repository in owner/repo format |
No | ${{ github.repository }} |
github-token |
Token used for API calls | No | ${{ github.token }} |
| Output | Description | When returned |
|---|---|---|
value |
Retrieved value (string/number) | get |
state |
All state as JSON string | get-all |
success |
Boolean indicating if operation succeeded | all |
Notes about success:
success = trueβ The requested operation completed logically (value found, state set/removed, etc.).success = falseand the step did NOT fail β A soft/expected domain miss (currently only: key not found forget/remove).success = falseand the step failed (the action marked the run withcore.setFailed) β An operational error (invalid inputs, API/network failure, etc.).
This lets you branch on domain misses without treating them as full step failures:
Minimum required permissions (repo-level or workflow permissions: block):
permissions:
issues: write
pull-requests: write- uses: FidelusAleksander/state-labels@v1
with:
operation: set
key: status
value: in-progress- uses: FidelusAleksander/state-labels@v1
with:
operation: set
key: review-count
value: '3'- uses: FidelusAleksander/state-labels@v1
id: get-status
with:
operation: get
key: status
- name: Use value
run: echo "Status: ${{ steps.get-status.outputs.value }}"- uses: FidelusAleksander/state-labels@v1
id: all
with:
operation: get-all
- name: Show state
run: echo '${{ steps.all.outputs.state }}'Example get-all output:
{
"status": "in-progress",
"review-count": 3,
"env": "staging"
}- uses: FidelusAleksander/state-labels@v1
with:
operation: remove
key: status- uses: FidelusAleksander/state-labels@v1
with:
operation: set
key: env
value: production
prefix: workflow
separator: __Creates label: workflow__env__production