mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
ci(infra): auto-remove waiting-on-author label on author reply (#37716)
Ports langchain-ai/deepagents#3626. Adds a workflow that clears the `waiting-on-author` label from an issue or PR as soon as the original author posts a follow-up comment, closing the manual loop where maintainers had to remember to strip the label after a reply landed.
This commit is contained in:
58
.github/workflows/remove_waiting_on_author.yml
vendored
Normal file
58
.github/workflows/remove_waiting_on_author.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Remove the `waiting-on-author` label from an issue or PR when the original
|
||||||
|
# author replies. Fires on every issue/PR comment; the job's `if:` filter skips
|
||||||
|
# runs unless the item is open, carries the label, and the commenter is the
|
||||||
|
# original author (and not a bot).
|
||||||
|
#
|
||||||
|
# Uses the default GITHUB_TOKEN so the label-removal event does NOT re-trigger
|
||||||
|
# other workflows. GitHub suppresses events created by the default GITHUB_TOKEN
|
||||||
|
# within workflow runs to prevent infinite loops.
|
||||||
|
|
||||||
|
name: Remove waiting-on-author on Author Reply
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
remove-label:
|
||||||
|
if: >-
|
||||||
|
github.event.issue.state == 'open' &&
|
||||||
|
contains(github.event.issue.labels.*.name, 'waiting-on-author') &&
|
||||||
|
github.event.comment.user.type != 'Bot' &&
|
||||||
|
github.event.comment.user.login == github.event.issue.user.login
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Remove waiting-on-author label
|
||||||
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo } = context.repo;
|
||||||
|
const issue_number = context.payload.issue.number;
|
||||||
|
const author = context.payload.issue.user.login;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`Author ${author} commented on #${issue_number} — removing waiting-on-author`,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number,
|
||||||
|
name: 'waiting-on-author',
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// 404: label not present (already removed or never applied).
|
||||||
|
if (e.status === 404) {
|
||||||
|
console.log('Label already absent — nothing to do');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user