{"id":13538150,"url":"https://github.com/github/lock","last_synced_at":"2025-06-12T22:03:59.243Z","repository":{"id":64166703,"uuid":"560174038","full_name":"github/lock","owner":"github","description":"Lock Action to support deployment locking for the branch-deploy Action","archived":false,"fork":false,"pushed_at":"2025-06-01T11:45:31.000Z","size":3393,"stargazers_count":42,"open_issues_count":6,"forks_count":7,"subscribers_count":67,"default_branch":"main","last_synced_at":"2025-06-09T22:58:00.433Z","etag":null,"topics":["actions","ci","deployments","github-actions","lock"],"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/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-31T22:28:14.000Z","updated_at":"2025-06-02T17:32:57.000Z","dependencies_parsed_at":"2024-01-16T15:40:30.818Z","dependency_job_id":"f7e8be40-a0eb-4264-90bd-67f1c9153d6d","html_url":"https://github.com/github/lock","commit_stats":{"total_commits":133,"total_committers":4,"mean_commits":33.25,"dds":0.03007518796992481,"last_synced_commit":"9b216a7eea43cafeeba3118e945b10c48055255a"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/github/lock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Flock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Flock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Flock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Flock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/lock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Flock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259539051,"owners_count":22873333,"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","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","ci","deployments","github-actions","lock"],"created_at":"2024-08-01T09:01:07.147Z","updated_at":"2025-06-12T22:03:59.221Z","avatar_url":"https://github.com/github.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# lock 🔒\n\n[![test](https://github.com/github/lock/actions/workflows/test.yml/badge.svg)](https://github.com/github/lock/actions/workflows/test.yml) [![lint](https://github.com/github/lock/actions/workflows/lint.yml/badge.svg)](https://github.com/github/lock/actions/workflows/lint.yml) [![package-check](https://github.com/github/lock/actions/workflows/package-check.yml/badge.svg)](https://github.com/github/lock/actions/workflows/package-check.yml) [![CodeQL](https://github.com/github/lock/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/github/lock/actions/workflows/codeql-analysis.yml)\n\nA standalone deployment locking Action to prevent multiple deployments from running at the same time\n\n\u003e If you came here from the [github/branch-deploy](https://github.com/github/branch-deploy) Action, you are in the right place!\n\n## About 💡\n\nCertain users for the [github/branch-deploy](https://github.com/github/branch-deploy) Action need more control over how, when, and why deployment locks are set. This Action allows you to have full control over when and how locks are set and removed.\n\n### Potential Use Cases 🗒️\n\n- Manually set a deployment lock via a workflow dispatch event\n- Conditionally set a deployment lock if your test suite is failing badly\n- Set a deployment lock over all your repositories during an a scheduled deploy lock window\n- Set a deployment lock via a comment on a pull request (supported out-of-the-box)\n\n## Usage 🚀\n\nThis section goes into detail on how you can use this Action in your own workflows!\n\n## Inputs 📥\n\n| Input | Required? | Default | Description |\n| ----- | --------- | ------- | ----------- |\n| `github_token` | `true` | `${{ github.token }}` | The GitHub token used to create an authenticated client - Provided for you by default! |\n| `environment` | `true` | `\"production\"` | The explict environment to apply locking actions to when running in headless mode - OR the default environment to use when running in the context of IssueOps commands in a comment - Examples: production, development, etc - Use \"global\" for the global lock environment |\n| `environment_targets` | `false` | `\"production,development,staging\"` | Optional (or additional) target environments to select for use with lock/unlock. Example, \"production,development,staging\". Example  usage: `.lock development`, `.lock production`, `.unlock staging` |\n| `reaction` | `false` | `eyes` | If set, the specified emoji \"reaction\" is put on the comment to indicate that the trigger was detected. For example, \"rocket\" or \"eyes\" |\n| `lock_trigger` | `false` | `.lock` | The string to look for in comments as an IssueOps lock trigger. Used for locking branch deployments on a specific branch. Example: \"lock\" |\n| `unlock_trigger` | `false` | `.unlock` | The string to look for in comments as an IssueOps unlock trigger. Used for unlocking branch deployments. Example: \"unlock\" |\n| `lock_info_alias` | `false` | `.wcid` | An alias or shortcut to get details about the current lock (if it exists) Example: \".info\" - Hubbers will find the \".wcid\" default helpful (\"where can I deploy\") |\n| `global_lock_flag` | `false` | `--global` | The flag to pass into the lock command to lock all environments on IssueOps commands in comments. Example: \"--global\" |\n| `prefix_only` | `false` | `\"true\"` | If \"false\", the trigger can match anywhere in the comment |\n| `mode` | `false` | - | The mode to use \"lock\", \"unlock\", or \"check\". If not provided, the default mode assumes the workflow is not headless and triggered by a comment on a pull request - Example: .lock / .unlock\n\n### About the `mode` Input\n\nIf you wish to use this Action via a comment on a pull request, simply omit the `mode` input. If you wish to use this Action via a workflow dispatch event, conditially in a custom workflow, or otherwise, you must provide the `mode` input. You are telling the Action what \"mode\" to use. The `mode` input can be either `lock`, `unlock`, or `check`.\n\n## Outputs 📤\n\n| Output | Description |\n| ------ | ----------- |\n| `triggered` | The string \"true\" if the trigger was found, otherwise the string \"false\" |\n| `comment_id` | The comment id which triggered this deployment |\n| `type` | The type of trigger which was found - 'lock', 'unlock', or 'info-info-alias' |\n| `comment_body` | The comment body which triggered this action (if it was not headless) |\n| `headless` | The string \"true\" if the run was headless, otherwise the string \"false\" - Headless in this context would be if the \"mode\" was set and the Action was not invoked by a comment on a pull request |\n| `locked` | If the \"mode\" is set to \"check\", this output is exported to show if the lock is set in a headless run |\n| `branch` | If the mode is set to \"check\", this output will be the branch name that holds the lock, otherwise it will be empty |\n| `created_by` | If the mode is set to \"check\", this output will be the user that holds the lock, otherwise it will be empty |\n| `created_at` | If the mode is set to \"check\", this output will be the ISO 8601 format date that the lock was claimed, otherwise it will be empty |\n| `reason` | If the mode is set to \"check\", this output will be the reason the deployment lock was claimed, otherwise it will be empty |\n| `link` | If the mode is set to \"check\", this output will be the link to the GitHub issue comment or action run that claimed the lock, otherwise it will be empty |\n| `global_lock_claimed` | The string \"true\" if the global lock was claimed |\n| `global_lock_released` | The string \"true\" if the global lock was released |\n| `lock_environment` | When running in headless mode and the \"mode\" is set to \"check\", this output will be the environment name that holds the lock, otherwise it will be empty |\n\n## Examples 📖\n\n\u003e Where `vX.X.X` is the latest version of this Action\n\n### Setting a Lock via an IssueOps Trigger (comment on a pull request)\n\n```yaml\nname: lock-or-unlock\n\non:\n  issue_comment:\n    types: [created]\n\npermissions:\n  pull-requests: write\n  contents: write\n\njobs:\n  lock-or-unlock:\n    if: ${{ github.event.issue.pull_request }} # only run on pull request comments\n    runs-on: ubuntu-latest\n    steps:\n      # Lock or Unlock via a comment (ex: .lock or .unlock)\n      - uses: github/lock@vX.X.X\n        id: lock\n```\n\n### Setting a Lock via a Workflow Dispatch Event\n\n```yaml\nname: lock-dispatch\n\non:\n  workflow_dispatch:\n    inputs:\n      reason:\n        description: 'Reason for claiming the deployment lock'\n        required: false\n      environment:\n        description: 'The environment to claim a lock for (production, staging, etc) - global is supported to claim the special global lock)'\n        required: true\n        default: 'production'\n      mode:\n        description: 'The mode to use: check, lock, unlock'\n        required: true\n        default: 'lock'\n\npermissions:\n  contents: write\n\njobs:\n  lock:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: github/lock@vX.X.X\n        id: lock\n        with:\n          mode: ${{ github.event.inputs.mode }}\n          reason: ${{ github.event.inputs.reason }}\n          environment: ${{ github.event.inputs.environment }}\n```\n\n### Removing a Lock via a Workflow Dispatch Event\n\n```yaml\nname: unlock\n\non:\n  workflow_dispatch:\n\npermissions:\n  contents: write\n\njobs:\n  unlock:\n    runs-on: ubuntu-latest\n    steps:\n      # Unlock\n      - uses: github/lock@vX.X.X\n        id: lock\n        with:\n          mode: \"unlock\"\n```\n\n### Setting a Lock Conditionally (basic example)\n\n```yaml\nname: lock (basic example)\n\n# on: (some event)\n\npermissions:\n  contents: write\n\njobs:\n  lock:\n    runs-on: ubuntu-latest\n    steps:\n\n      # if something occurs, set the lock below\n\n      # Unlock\n      - uses: github/lock@vX.X.X\n        id: lock\n        with:\n          mode: \"lock\"\n```\n\n### Checking if a Lock is Set (basic example) - headless\n\n```yaml\nname: lock-check\n\non:\n  workflow_dispatch:\n\npermissions:\n  contents: read\n\njobs:\n  lock-check:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: github/lock@vX.X.X\n        id: lock\n        with:\n          mode: check\n\n      - name: Print lock status\n        run: |\n          echo \"Lock status: ${{ steps.lock.outputs.locked }}\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Flock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Flock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Flock/lists"}