From 4be0dfc8c4c83fe7727bd261d27bdd97e6d14e07 Mon Sep 17 00:00:00 2001 From: y-oksaku Date: Thu, 25 Apr 2024 01:49:46 +0000 Subject: [PATCH] fix: set pipeline access token into event.creator --- plugins/events/create.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/events/create.js b/plugins/events/create.js index 2e64c60b6..200c5b51a 100644 --- a/plugins/events/create.js +++ b/plugins/events/create.js @@ -21,7 +21,7 @@ module.exports = () => ({ handler: async (request, h) => { const { buildFactory, jobFactory, eventFactory, pipelineFactory, userFactory } = request.server.app; const { buildId, causeMessage, creator } = request.payload; - const { scmContext, username } = request.auth.credentials; + const { scmContext, username, scope } = request.auth.credentials; const { scm } = eventFactory; const { isValidToken } = request.server.plugins.pipelines; const { updateAdmins } = request.server.plugins.events; @@ -79,6 +79,11 @@ module.exports = () => ({ if (creator) { payload.creator = creator; + } else if (scope.includes('pipeline')) { + payload.creator = { + name: 'Pipeline Access Token', // Display name + username + }; } // Check for startFrom