{"id":20619206,"url":"https://github.com/jorgebg/stateful-action","last_synced_at":"2025-09-09T01:33:24.000Z","repository":{"id":65160354,"uuid":"258353163","full_name":"jorgebg/stateful-action","owner":"jorgebg","description":"An utility for managing the state of your application on a reserved branch.","archived":false,"fork":false,"pushed_at":"2022-10-18T07:49:48.000Z","size":8,"stargazers_count":8,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T01:32:58.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jorgebg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-23T23:15:57.000Z","updated_at":"2025-01-29T21:23:13.000Z","dependencies_parsed_at":"2023-01-13T15:43:52.544Z","dependency_job_id":null,"html_url":"https://github.com/jorgebg/stateful-action","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"bd279992190b64c6a5906c3b75a6f2835823ab46"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jorgebg/stateful-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgebg%2Fstateful-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgebg%2Fstateful-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgebg%2Fstateful-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgebg%2Fstateful-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jorgebg","download_url":"https://codeload.github.com/jorgebg/stateful-action/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jorgebg%2Fstateful-action/sbom","scorecard":{"id":532864,"data":{"date":"2025-08-11","repo":{"name":"github.com/jorgebg/stateful-action","commit":"bd279992190b64c6a5906c3b75a6f2835823ab46"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/example.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/example.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/jorgebg/stateful-action/example.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T06:09:24.923Z","repository_id":65160354,"created_at":"2025-08-20T06:09:24.923Z","updated_at":"2025-08-20T06:09:24.923Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274232028,"owners_count":25245856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T12:11:01.148Z","updated_at":"2025-09-09T01:33:23.975Z","avatar_url":"https://github.com/jorgebg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💾 Stateful Action\n\nThis action is an utility for managing the state of your application on a branch reserved for this purpose.\n\n## How it works\n\nIt wraps the run like this:\n\n1. `state` branch is checked out as a [worktree](https://git-scm.com/docs/git-worktree) under a folder named `.state` (which must be ignored by `.gitignore`). Please check [`scripts/main.sh`](scripts/main.sh).\n2. Your application writes its state into the `.state` folder.\n3. Changes in `state` branch are commited and pushed to origin. Please check [`scripts/post.sh`](scripts/post.sh):\n    * Changes are commited and pushed.\n    * Old commits on `state` branch are squashed and force-pushed.\n    * `.state` worktree is removed.\n\n\n\nYour application might also commit or push changes at step 2 if needed.\n\n\n## Requirements\n\n- The repository must reserve a branch for keeping the state. By default its name is `state`. It can be set by the [`branch` input](action.yml).\n- A folder with the same name as the state branch prefixed by a dot must be ignored in `.gitignore` ([example](.gitignore)). As the default branch is `state`, the folder ignored by default would be `.state`.\n- Repository must be checked out first ([`actions/checkout@v2`](github.com/actions/checkout)).\n\n## Usage\n\n### Example workflow\n\n```\nname: Example workflow\non:\n  push:\n    branches: [master]\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - uses: jorgebg/stateful-action@v0.1\n    - name: Test Run\n      run: echo $(date)\\n \u003e\u003e .state/data.txt\n```\nPlease take a look at the **[example workflow](.github/workflows/example.yml)** running on this repository.\n\n\n### Inputs\n\n- `branch`: the name of the branch that will store the state. Default: `state`.\n- `backup`: number of last commits to keep as a backup. Default: `100`.\n\n- `git_author_name`: author name used for the commits. Default: `Stateful Action Bot`.\n- `git_author_email`: author email used for the commits. Default: `stateful-action@example.com`.\n\n\n## Real-life examples\n\n- [RSS Reader](https://github.com/jorgebg/reader)\n- [Air Quality Monitoring Station](https://github.com/jorgebg/airquality)\n- Twitter Bot (WIP)\n\n\n## Testing\n\n### Simple testing\n\n```\nnode main.js \u0026\u0026 echo $(date)\\n \u003e\u003e .state/data.txt\nnode post.js\n```\n\n### Testing with `act`\n\nThe action can be tested locally with [`act`](https://github.com/nektos/act). It requires `git` and `sed`, so use the image `node:12.6-buster` instead of the _slim_ version:\n\n```\nact -P ubuntu-latest=node:12.6-buster\n```\n\nYou'll also need to setup GitHub credentials.\n\n#### Known issues\n\nHere is a workaround I'm using for https://github.com/nektos/act/issues/185:\n\n```\nrm -rf action\nmkdir action\ncp -R action.yml *.js scripts action\nsed -i -E 's/uses: .\\/$/uses: .\\/action/g' .github/workflows/example.yml\n```\n\nIt copies the local action into `action` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgebg%2Fstateful-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorgebg%2Fstateful-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgebg%2Fstateful-action/lists"}