Commit 0b723b3
Add unlock functionality for reopened issues and PRs in locker workflow (#119003)
This PR enhances the `.github/workflows/locker.yml` workflow to
automatically unlock issues and pull requests when they are reopened,
addressing the need to make previously locked items accessible again
when discussion resumes.
## Changes Made
### New Event Triggers
- Added `issues.reopened` trigger to detect when closed issues are
reopened
- Added `pull_request_target.reopened` trigger to detect when closed PRs
are reopened
### Enhanced Job Logic
- **Lock job** (renamed from `main` for clarity):
- Added condition to prevent execution on reopened events:
`github.event_name != 'issues' && github.event_name !=
'pull_request_target'`
- Preserves existing functionality for scheduled runs and manual
dispatch
- **New unlock job**:
- Only executes when issues or PRs are reopened: `github.event.action ==
'reopened'`
- Uses `actions/github-script@v7` with GitHub REST API to unlock items
- Handles both issues and pull requests with a single step (since GitHub
treats PRs as issues in the API)
- Only unlocks if the item is actually locked:
`github.event.issue.locked == true`
### Workflow Behavior
- **Before**: Issues/PRs remained locked after being reopened,
preventing further discussion
- **After**: Issues/PRs are automatically unlocked when reopened,
allowing immediate participation
## Technical Implementation
The unlock functionality uses the GitHub Issues API (which also handles
PRs) through `actions/github-script@v7`:
```javascript
await github.rest.issues.unlock({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
```
This ensures that when maintainers or contributors reopen issues or PRs
for continued discussion, they won't encounter locked conversation
threads that prevent community engagement.
Fixes the workflow gap where reopened items remained inaccessible for
comments despite being active again.
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/dotnet/runtime/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: akoeplinger <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
Co-authored-by: Copilot <[email protected]>1 parent 67e6e17 commit 0b723b3
1 file changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
22 | 28 | | |
23 | | - | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments