[FFmpeg-cvslog] [ffmpeg] branch master updated. 274e00ea84 forgejo/autolabeler: clean up logic a bit and prevent self-looping
ffmpeg-git at ffmpeg.org
ffmpeg-git at ffmpeg.org
Sun Aug 10 02:53:01 EEST 2025
The branch, master has been updated
via 274e00ea84cab4f198ffab5a9a508445703a596e (commit)
from 26a2a76346457e33408ca9ef5453b1d14cca2504 (commit)
- Log -----------------------------------------------------------------
commit 274e00ea84cab4f198ffab5a9a508445703a596e
Author: Timo Rothenpieler <timo at rothenpieler.org>
AuthorDate: Fri Aug 8 21:37:20 2025 +0200
Commit: Timo Rothenpieler <timo at rothenpieler.org>
CommitDate: Sun Aug 10 01:50:46 2025 +0200
forgejo/autolabeler: clean up logic a bit and prevent self-looping
The loop-protection only takes effect for the automatic token, not for
ffmpeg-devels PAT.
diff --git a/.forgejo/labeler/labeler.js b/.forgejo/labeler/labeler.js
index 578ec29096..b1c05787f0 100644
--- a/.forgejo/labeler/labeler.js
+++ b/.forgejo/labeler/labeler.js
@@ -3,6 +3,17 @@ module.exports = async ({github, context}) => {
const labels = [];
const issueNumber = context.payload.pull_request?.number || context.payload.issue?.number;
+ const kwmap = {
+ 'avcodec': 'avcodec',
+ 'avdevice': 'avdevice',
+ 'avfilter': 'avfilter',
+ 'avformat': 'avformat',
+ 'avutil': 'avutil',
+ 'swresample': 'swresample',
+ 'swscale': 'swscale',
+ 'fftools': 'CLI'
+ };
+
async function isOrgMember(username) {
try {
const response = await github.rest.orgs.checkMembershipForUser({
@@ -15,47 +26,33 @@ module.exports = async ({github, context}) => {
}
}
- var removeNew = context.payload.action === 'closed';
-
- if (context.payload.action !== 'opened' && await isOrgMember(context.payload.sender.login)) {
- if (context.payload.action === 'assigned' ||
- context.payload.action === 'labeled' ||
- context.payload.action === 'unlabeled' ||
- context.payload.comment) {
- removeNew = true;
- console.log('Removing "new" label due to member interaction.');
- }
- }
-
- if (removeNew) {
+ if (context.payload.action === 'closed' ||
+ (context.payload.action !== 'opened' && (
+ context.payload.action === 'assigned' ||
+ context.payload.action === 'label_updated' ||
+ context.payload.comment) &&
+ await isOrgMember(context.payload.sender.login))
+ ) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
- name: 'new'
+ // this should say 'new', but forgejo deviates from GitHub API here and expects the ID
+ name: '41'
});
console.log('Removed "new" label');
} catch (error) {
- console.log('Could not remove "new" label');
+ if (error.status !== 404 && error.status !== 410) {
+ console.log('Could not remove "new" label');
+ }
}
} else if (context.payload.action === 'opened') {
labels.push('new');
console.log('Detected label: new');
}
- if (context.payload.action === 'opened' || context.payload.action === 'edited') {
- const kwmap = {
- 'avcodec': 'avcodec',
- 'avdevice': 'avdevice',
- 'avfilter': 'avfilter',
- 'avformat': 'avformat',
- 'avutil': 'avutil',
- 'swresample': 'swresample',
- 'swscale': 'swscale',
- 'fftools': 'CLI'
- };
-
+ if ((context.payload.action === 'opened' || context.payload.action === 'edited') && context.eventName !== 'issue_comment') {
for (const [kw, label] of Object.entries(kwmap)) {
if (title.includes(kw)) {
labels.push(label);
diff --git a/.forgejo/workflows/autolabel.yml b/.forgejo/workflows/autolabel.yml
index 1651bc5164..cb4dac67aa 100644
--- a/.forgejo/workflows/autolabel.yml
+++ b/.forgejo/workflows/autolabel.yml
@@ -9,6 +9,7 @@ on:
jobs:
pr_labeler:
runs-on: utilities
+ if: ${{ github.event.sender.login != 'ffmpeg-devel' }}
steps:
- name: Checkout
uses: actions/checkout at v4
-----------------------------------------------------------------------
Summary of changes:
.forgejo/labeler/labeler.js | 51 +++++++++++++++++++---------------------
.forgejo/workflows/autolabel.yml | 1 +
2 files changed, 25 insertions(+), 27 deletions(-)
hooks/post-receive
--
More information about the ffmpeg-cvslog
mailing list