You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by xt...@apache.org on 2026/03/19 02:44:52 UTC
(flink-agents) branch main updated (84e065b2 -> 0b1dab7a)
This is an automated email from the ASF dual-hosted git repository.
xtsong pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
from 84e065b2 [infra] Download JARs from Maven Central during pip install (#567)
new 48cd1e3f [infra] Use GHA workflow triggers to run pull request labeler workflow
new 0b1dab7a [minor] Update fixVersion label from 'fixVersion/0.1.1' to 'fixVersion/0.1.2'
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/document_bot.yml | 44 --------
.../workflows/{labeler.yml => pr_edit_trigger.yml} | 22 ++--
.github/workflows/pr_labeler.js | 121 +++++++++++++++++++++
.github/workflows/pr_labeler.yml | 51 +++++++++
.../{labeler.yml => workflows/pr_open_trigger.yml} | 28 +++--
5 files changed, 195 insertions(+), 71 deletions(-)
delete mode 100644 .github/workflows/document_bot.yml
rename .github/workflows/{labeler.yml => pr_edit_trigger.yml} (76%)
create mode 100644 .github/workflows/pr_labeler.js
create mode 100644 .github/workflows/pr_labeler.yml
rename .github/{labeler.yml => workflows/pr_open_trigger.yml} (59%)
(flink-agents) 01/02: [infra] Use GHA workflow triggers to run pull request labeler workflow
Posted by xt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xtsong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 48cd1e3f5efde5652d75c9d7b521e574a5991a8f
Author: youjin <me...@gmail.com>
AuthorDate: Tue Mar 10 15:16:23 2026 +0800
[infra] Use GHA workflow triggers to run pull request labeler workflow
---
.github/workflows/document_bot.yml | 44 --------
.../workflows/{labeler.yml => pr_edit_trigger.yml} | 22 ++--
.github/workflows/pr_labeler.js | 121 +++++++++++++++++++++
.github/workflows/pr_labeler.yml | 51 +++++++++
.../{labeler.yml => workflows/pr_open_trigger.yml} | 28 +++--
5 files changed, 195 insertions(+), 71 deletions(-)
diff --git a/.github/workflows/document_bot.yml b/.github/workflows/document_bot.yml
deleted file mode 100644
index bf4a8e73..00000000
--- a/.github/workflows/document_bot.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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: "Documentation Bot"
-
-on:
- pull_request_target:
- types:
- - opened
- - edited
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
- cancel-in-progress: true
-
-jobs:
- label:
- if: (github.repository == 'apache/flink-agents') && (github.event.pull_request.state == 'open')
- permissions:
- pull-requests: write
- runs-on: ubuntu-24.04
- steps:
- - name: Labeling
- uses: apache/pulsar-test-infra/docbot@8ff059e49446fff5bb9baf2de4a12bc05c2d57ab
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- LABEL_WATCH_LIST: 'doc-needed,doc-not-needed,doc-included'
- LABEL_MISSING: 'doc-label-missing'
diff --git a/.github/workflows/labeler.yml b/.github/workflows/pr_edit_trigger.yml
similarity index 76%
rename from .github/workflows/labeler.yml
rename to .github/workflows/pr_edit_trigger.yml
index 33c02afc..3b3e00dc 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/pr_edit_trigger.yml
@@ -15,19 +15,17 @@
# specific language governing permissions and limitations
# under the License.
-name: "Pull Request Labeler"
-
+name: PR-Edit-Trigger
on:
- pull_request_target:
- types:
- - opened
+ pull_request:
+ types: [edited]
+ branches:
+ - main
+ - release-*
+
jobs:
- triage:
- if: (github.repository == 'apache/flink-agents')
- permissions:
- contents: read
- pull-requests: write
- issues: write
+ label:
runs-on: ubuntu-latest
steps:
- - uses: actions/labeler@v5
\ No newline at end of file
+ - name: "Do nothing. Just triggers corresponding workflow."
+ run: echo
diff --git a/.github/workflows/pr_labeler.js b/.github/workflows/pr_labeler.js
new file mode 100644
index 00000000..f34764df
--- /dev/null
+++ b/.github/workflows/pr_labeler.js
@@ -0,0 +1,121 @@
+/*
+ * 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, workflowRunId, triggerWorkflow }) => {
+ // Retrieve the PR number from the workflow run that triggered this job
+ const { data: run } = await github.rest.actions.getWorkflowRun({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ run_id: workflowRunId,
+ });
+ let prNumber = run.pull_requests?.[0]?.number;
+
+ // Fallback for fork PRs: pull_requests is empty for cross-repo workflow runs
+ if (!prNumber) {
+ core.info(`No PR in pull_requests array, falling back to search by head branch...`);
+ const { data: pullRequests } = await github.rest.pulls.list({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ state: 'open',
+ head: `${run.head_repository.owner.login}:${run.head_branch}`,
+ });
+ prNumber = pullRequests[0]?.number;
+ }
+
+ if (!prNumber) {
+ core.setFailed(`No pull request found for workflow run ${workflowRunId}`);
+ return;
+ }
+ core.info(`Found PR #${prNumber} from workflow run ${workflowRunId}`);
+
+ const { data: pr } = await github.rest.pulls.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: prNumber,
+ });
+
+ const isOpenTrigger = triggerWorkflow === 'PR-Open-Trigger';
+ const labels = [];
+
+ // --- Labels only added on PR open (priority/major, fixVersion) ---
+
+ if (isOpenTrigger) {
+ labels.push('priority/major');
+
+ const baseBranch = pr.base.ref;
+ const fixVersionLabelMap = {
+ 'main': 'fixVersion/0.3.0',
+ 'release-0.2': 'fixVersion/0.2.1',
+ 'release-0.1': 'fixVersion/0.1.1',
+ };
+ const fixVersionLabel = fixVersionLabelMap[baseBranch];
+ if (fixVersionLabel) {
+ labels.push(fixVersionLabel);
+ }
+ }
+
+ // --- Documentation labels (evaluated on both open and edit) ---
+
+ const docLabels = ['doc-needed', 'doc-not-needed', 'doc-included'];
+ const docMissingLabel = 'doc-label-missing';
+ const prBody = pr.body || '';
+ const checkedDocLabel = docLabels.find(label => {
+ const pattern = new RegExp(`-\\s*\\[x\\]\\s*\`${label}\``, 'i');
+ return pattern.test(prBody);
+ });
+
+ // Remove all existing doc labels first
+ const { data: existingLabels } = await github.rest.issues.listLabelsOnIssue({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ });
+ const allDocLabels = [...docLabels, docMissingLabel];
+ for (const existingLabel of existingLabels) {
+ if (allDocLabels.includes(existingLabel.name)) {
+ await github.rest.issues.removeLabel({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ name: existingLabel.name,
+ });
+ core.info(`Removed existing doc label '${existingLabel.name}'.`);
+ }
+ }
+
+ if (checkedDocLabel) {
+ labels.push(checkedDocLabel);
+ core.info(`Documentation checkbox checked: '${checkedDocLabel}'.`);
+ } else {
+ labels.push(docMissingLabel);
+ core.info('No documentation checkbox checked, adding doc-label-missing.');
+ }
+
+ // --- Apply all labels ---
+
+ if (labels.length > 0) {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ labels: labels,
+ });
+ core.info(`Added labels: ${labels.join(', ')}`);
+ } else {
+ core.info('No labels to add.');
+ }
+};
diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml
new file mode 100644
index 00000000..958fbc9b
--- /dev/null
+++ b/.github/workflows/pr_labeler.yml
@@ -0,0 +1,51 @@
+# 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: "Pull Request Labeler"
+
+on:
+ workflow_run:
+ workflows: [PR-Open-Trigger, PR-Edit-Trigger]
+ types: [requested]
+
+concurrency:
+ group: ${{ github.event.workflow_run.name }}-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}
+ cancel-in-progress: true
+
+permissions:
+ checks: write
+ contents: read
+ pull-requests: 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 pull request"
+ uses: actions/github-script@v7
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const script = require('./.github/workflows/pr_labeler.js');
+ const workflowRunId = ${{ github.event.workflow_run.id }};
+ const triggerWorkflow = '${{ github.event.workflow_run.name }}';
+ await script({ github, context, core, workflowRunId, triggerWorkflow });
diff --git a/.github/labeler.yml b/.github/workflows/pr_open_trigger.yml
similarity index 59%
rename from .github/labeler.yml
rename to .github/workflows/pr_open_trigger.yml
index a7ee65dd..99a41904 100644
--- a/.github/labeler.yml
+++ b/.github/workflows/pr_open_trigger.yml
@@ -15,19 +15,17 @@
# specific language governing permissions and limitations
# under the License.
-# Add 'priority/major' label to any changes within the entire repository
-priority/major:
- - changed-files:
- - any-glob-to-any-file: '**'
+name: PR-Open-Trigger
+on:
+ pull_request:
+ types: [opened]
+ branches:
+ - main
+ - release-*
-# Add 'fixVersion/0.3.0' label to any PR that is opened against the `main` branch
-fixVersion/0.3.0:
- - base-branch: 'main'
-
-# Add 'fixVersion/0.2.1' label to any PR that is opened against the `release-0.2` branch
-fixVersion/0.2.1:
- - base-branch: 'release-0.2'
-
-# Add 'fixVersion/0.1.1' label to any PR that is opened against the `release-0.1` branch
-fixVersion/0.1.1:
- - base-branch: 'release-0.1'
\ No newline at end of file
+jobs:
+ label:
+ runs-on: ubuntu-latest
+ steps:
+ - name: "Do nothing. Just triggers corresponding workflow."
+ run: echo
(flink-agents) 02/02: [minor] Update fixVersion label from 'fixVersion/0.1.1' to 'fixVersion/0.1.2'
Posted by xt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xtsong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 0b1dab7a3189313829af8ea2d639c154d0497d30
Author: youjin <me...@gmail.com>
AuthorDate: Wed Mar 18 19:13:50 2026 +0800
[minor] Update fixVersion label from 'fixVersion/0.1.1' to 'fixVersion/0.1.2'
---
.github/workflows/pr_labeler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/pr_labeler.js b/.github/workflows/pr_labeler.js
index f34764df..2680185e 100644
--- a/.github/workflows/pr_labeler.js
+++ b/.github/workflows/pr_labeler.js
@@ -60,7 +60,7 @@ module.exports = async ({ github, context, core, workflowRunId, triggerWorkflow
const fixVersionLabelMap = {
'main': 'fixVersion/0.3.0',
'release-0.2': 'fixVersion/0.2.1',
- 'release-0.1': 'fixVersion/0.1.1',
+ 'release-0.1': 'fixVersion/0.1.2',
};
const fixVersionLabel = fixVersionLabelMap[baseBranch];
if (fixVersionLabel) {