{"id":27715713,"url":"https://github.com/guibranco/github-artifact-lock-action","last_synced_at":"2026-03-16T05:27:03.275Z","repository":{"id":289510481,"uuid":"971506831","full_name":"guibranco/github-artifact-lock-action","owner":"guibranco","description":"🔐 :octocat: Step-level locking in GitHub Actions using artifact-based mutexes — serialize workflow steps across jobs or PRs with no external services.","archived":false,"fork":false,"pushed_at":"2026-02-23T03:26:53.000Z","size":63,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-23T11:41:11.414Z","etag":null,"topics":["actions","artifacts","concurrency","gh-actions","github","hacktoberfest","lock","locking","mutex","semaphore","step","workflow"],"latest_commit_sha":null,"homepage":"http://guilherme.stracini.com.br/github-artifact-lock-action/","language":null,"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/guibranco.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-23T16:14:53.000Z","updated_at":"2026-02-23T03:26:33.000Z","dependencies_parsed_at":"2025-08-11T06:23:25.193Z","dependency_job_id":"2bd09d65-f8f5-44a5-aaa4-7bbef1a47692","html_url":"https://github.com/guibranco/github-artifact-lock-action","commit_stats":null,"previous_names":["guibranco/github-artifact-lock-action"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/guibranco/github-artifact-lock-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fgithub-artifact-lock-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fgithub-artifact-lock-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fgithub-artifact-lock-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fgithub-artifact-lock-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guibranco","download_url":"https://codeload.github.com/guibranco/github-artifact-lock-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2Fgithub-artifact-lock-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30567777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-16T04:42:47.996Z","status":"ssl_error","status_checked_at":"2026-03-16T04:42:44.668Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["actions","artifacts","concurrency","gh-actions","github","hacktoberfest","lock","locking","mutex","semaphore","step","workflow"],"created_at":"2025-04-27T01:13:50.137Z","updated_at":"2026-03-16T05:27:03.270Z","avatar_url":"https://github.com/guibranco.png","language":null,"readme":"# GitHub Artifact Lock Action\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub repo](https://img.shields.io/badge/GitHub-guibranco%2Fgithub--artifact--lock--action-green.svg?style=flat-square\u0026logo=github)](https://github.com/guibranco/github-artifact-lock-action)\n[![GitHub last commit](https://img.shields.io/github/last-commit/guibranco/github-artifact-lock-action?color=green\u0026logo=github\u0026style=flat-square\u0026label=Last%20commit)](https://github.com/guibranco/github-artifact-lock-action)\n[![GitHub license](https://img.shields.io/github/license/guibranco/github-artifact-lock-action?color=green\u0026logo=github\u0026style=flat-square\u0026label=License)](https://github.com/guibranco/github-artifact-lock-action)\n![CI](https://github.com/guibranco/github-artifact-lock-action/actions/workflows/ci.yml/badge.svg)\n[![wakatime](https://wakatime.com/badge/github/guibranco/github-artifact-lock-action.svg)](https://wakatime.com/badge/github/guibranco/github-artifact-lock-action)\n\n\u003c/div\u003e\n\n## 📋 Overview\n\nA reusable composite GitHub Action to implement a **step-level mutex lock** using GitHub Artifacts as the locking mechanism. This action enables serialized access to shared resources (like test environments, deployment targets, or external systems) across parallel workflows or pull requests.\n\n## 🚀 Features\n\n- 🔒 **Lock Acquisition**: Securely acquire locks before accessing shared resources\n- 🔓 **Automatic Release**: Release locks reliably when operations complete\n- ⏱️ **Configurable Timing**: Customize wait times and retry attempts\n- 🌐 **Zero Dependencies**: Uses GitHub-native APIs only—no external services required\n- 🛡️ **Failure Handling**: Ensures locks are released even when workflows fail\n- 📊 **Workflow-Agnostic**: Works across different workflows and repositories\n\n## 💡 When To Use\n\n- Running integration tests that require exclusive access to test environments\n- Managing deployments to shared staging environments\n- Controlling access to external rate-limited APIs\n- Preventing race conditions when multiple workflows update shared resources\n- Implementing sequential processing when parallel execution isn't safe\n\n## 📦 Installation\n\nAdd this action to your workflow YAML files. No additional setup required!\n\n## ⚙️ Inputs\n\n| Input | Description | Required | Default |\n|-------|-------------|:--------:|---------|\n| `lock-name` | Unique identifier for the lock (artifact name) | No | `test-lock` |\n| `wait-seconds` | Wait time between retry attempts (in seconds) | No | `10` |\n| `max-attempts` | Maximum number of retry attempts before failing | No | `30` |\n\n## 📤 Outputs\n\nThis action doesn't provide explicit outputs, but creates and removes artifacts that serve as locks.\n\n## 🧪 Usage Examples\n\n### Basic Usage\n\n```yaml\nname: test\non: [push, pull_request]\n\npermissions:\n  actions: write\n  contents: read\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Acquire test lock 🔐\n        uses: guibranco/github-artifact-lock-action@v2.0.5\n        with:\n          lock-name: test-lock\n\n      - name: Run tests 🧪\n        run: echo \"Tests running safely...\"\n\n      - name: Release test lock 🔓\n        if: always()\n        uses: guibranco/github-artifact-lock-action/release-lock@v2.0.5\n        with:\n          lock-name: test-lock\n````\n\n### Advanced Configuration\n\n```yaml\nname: deploy\non: [push]\n\npermissions:\n  actions: write\n  contents: read\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Acquire deployment lock 🔐\n        uses: guibranco/github-artifact-lock-action@v2.0.5\n        with:\n          lock-name: staging-environment-lock\n          wait-seconds: 30\n          max-attempts: 20\n\n      - name: Deploy to staging 🚀\n        run: ./deploy.sh --env staging\n\n      - name: Release deployment lock 🔓\n        if: always()\n        uses: guibranco/github-artifact-lock-action/release-lock@v2.0.5\n        with:\n          lock-name: staging-environment-lock\n```\n\n### Multiple Locks\n\n```yaml\nname: integration\non: [push]\n\npermissions:\n  actions: write\n  contents: read\n\njobs:\n  integration:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Acquire database lock 🔐\n        uses: guibranco/github-artifact-lock-action@v2.0.5\n        with:\n          lock-name: db-lock\n\n      - name: Acquire API lock 🔐\n        uses: guibranco/github-artifact-lock-action@v2.0.5\n        with:\n          lock-name: api-lock\n\n      - name: Run integration tests 🧪\n        run: npm run integration-tests\n\n      - name: Release API lock 🔓\n        if: always()\n        uses: guibranco/github-artifact-lock-action/release-lock@v2.0.5\n        with:\n          lock-name: api-lock\n\n      - name: Release database lock 🔓\n        if: always()\n        uses: guibranco/github-artifact-lock-action/release-lock@v2.0.5\n        with:\n          lock-name: db-lock\n```\n\n## 🛠️ How It Works\n\nThe action creates a locking mechanism by leveraging GitHub Artifacts storage:\n\n1. **Check**: Before executing a critical step, it checks for an existing GitHub Artifact named `lock-name`\n2. **Wait**: If the lock artifact exists, another workflow is using the resource, so this workflow waits\n3. **Retry**: The action retries periodically until the lock is free or `max-attempts` is reached\n4. **Acquire**: Once free, it uploads a small placeholder artifact with the `lock-name` to claim the lock\n5. **Execute**: Your workflow steps run with exclusive access to the resource\n6. **Release**: The release-lock action removes the artifact, freeing the resource for other workflows\n\n## 🔄 Integration with Other Actions\n\nThis action works well with:\n\n* Deployment actions like `actions/deploy-pages`\n* Testing frameworks\n* Database migration tools\n* Any workflow requiring resource coordination\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n* **Lock never releases**: Ensure the release step has `if: always()` to run even when prior steps fail\n* **Timeouts**: Adjust `wait-seconds` and `max-attempts` for longer-running operations\n* **Permissions**: Ensure workflow has sufficient permissions to read/write artifacts\n\n### Debugging\n\nEnable GitHub Actions debug logging by setting a secret named `ACTIONS_STEP_DEBUG` to `true`.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👏 Acknowledgments\n\n* Inspired by the need for coordinating concurrent GitHub workflows\n* Thanks to all contributors who helped improve this action\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fgithub-artifact-lock-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguibranco%2Fgithub-artifact-lock-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fgithub-artifact-lock-action/lists"}