This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new d17edb11 [infra] Add daily workflow to label closed issues missing 
fixVersion (#605)
d17edb11 is described below

commit d17edb117fc1f9d82e3d4b2de39a5d17278c5842
Author: Eugene <[email protected]>
AuthorDate: Fri May 15 17:29:43 2026 +0800

    [infra] Add daily workflow to label closed issues missing fixVersion (#605)
---
 .github/workflows/issue_labeler.js  | 57 +++++++++++++++++++++++++++++++++++++
 .github/workflows/issue_labeler.yml | 44 ++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)

diff --git a/.github/workflows/issue_labeler.js 
b/.github/workflows/issue_labeler.js
new file mode 100644
index 00000000..004887b0
--- /dev/null
+++ b/.github/workflows/issue_labeler.js
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = async ({ github, context, core }) => {
+  const owner = context.repo.owner;
+  const repo = context.repo.repo;
+
+  // Search for issues closed as completed in the last 2 days without 
fixVersion/missing
+  const twoDaysAgo = new Date();
+  twoDaysAgo.setDate(twoDaysAgo.getDate() - 2);
+  const sinceDate = twoDaysAgo.toISOString().split('T')[0];
+
+  const query = `repo:${owner}/${repo} is:issue is:closed reason:completed 
-label:"fixVersion/missing" closed:>=${sinceDate}`;
+  core.info(`Search query: ${query}`);
+
+  const { data: searchResult } = await 
github.rest.search.issuesAndPullRequests({
+    q: query,
+    per_page: 100,
+  });
+
+  core.info(`Found ${searchResult.total_count} closed issues to check.`);
+
+  let labeledCount = 0;
+
+  for (const issue of searchResult.items) {
+    const hasFixVersion = issue.labels.some(label => 
label.name.startsWith('fixVersion/'));
+
+    if (!hasFixVersion) {
+      await github.rest.issues.addLabels({
+        owner,
+        repo,
+        issue_number: issue.number,
+        labels: ['fixVersion/missing'],
+      });
+      labeledCount++;
+      core.info(`Added 'fixVersion/missing' to issue #${issue.number}: 
${issue.title}`);
+    } else {
+      core.info(`Issue #${issue.number} already has fixVersion label, 
skipping.`);
+    }
+  }
+
+  core.info(`Done. Labeled ${labeledCount} issue(s) with 
'fixVersion/missing'.`);
+};
diff --git a/.github/workflows/issue_labeler.yml 
b/.github/workflows/issue_labeler.yml
new file mode 100644
index 00000000..714db410
--- /dev/null
+++ b/.github/workflows/issue_labeler.yml
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: "Issue Labeler"
+
+on:
+  schedule:
+    - cron: '0 0 * * *'
+  workflow_dispatch:
+
+permissions:
+  contents: read
+  issues: write
+
+jobs:
+  label:
+    if: github.repository == 'apache/flink-agents'
+    runs-on: ubuntu-latest
+    steps:
+      - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+        uses: actions/checkout@v6
+        with:
+          persist-credentials: false
+      - name: "Label issues missing fixVersion"
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            const script = require('./.github/workflows/issue_labeler.js');
+            await script({ github, context, core });

Reply via email to