potiuk commented on code in PR #43886:
URL: https://github.com/apache/airflow/pull/43886#discussion_r1837089032


##########
.github/workflows/backport-action.yml:
##########
@@ -0,0 +1,47 @@
+# 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: Automatic backport action
+on:  # yamllint disable-line rule:truthy
+  pull_request_target:
+    types: ['labeled', 'closed']
+    branches: ['main']
+permissions:
+  contents: write
+  pull-requests: write
+jobs:
+  backport:
+    name: Backport PR ${{ github.event.pull_request.number }}
+    if: >
+      github.event.pull_request.merged == true &&
+      contains(join(github.event.pull_request.labels.*.name, ' '), 
'backport-to-')
+    runs-on: ubuntu-latest
+    steps:
+      - name: Execute Backport Action
+        uses: 
sorenlouv/backport-github-action@ad888e978060bc1b2798690dd9d03c4036560947  # 
v9.5.1

Review Comment:
   ok. It was not that straightforward, I needed to guess the right versions of 
dependencies used to generate the index.js but I figured out that node 20.18.0 
(latest from 20.* line) + latest yarn available, gives small difference (likely 
due to some patch-level difference in deps). Close enough and inspection of the 
code did not reveal anything suspicious.
   
   ```diff
   diff --git a/dist/index.js b/dist/index.js
   index 44bbf57..d707fb1 100644
   --- a/dist/index.js
   +++ b/dist/index.js
   @@ -7054,69 +7054,6 @@ class Settings {
    exports["default"] = Settings;
    
    
   -/***/ }),
   -
   -/***/ 40334:
   -/***/ ((__unused_webpack_module, exports) => {
   -
   -"use strict";
   -
   -
   -Object.defineProperty(exports, "__esModule", ({ value: true }));
   -
   -const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
   -const REGEX_IS_INSTALLATION = /^ghs_/;
   -const REGEX_IS_USER_TO_SERVER = /^ghu_/;
   -async function auth(token) {
   -  const isApp = token.split(/\./).length === 3;
   -  const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || 
REGEX_IS_INSTALLATION.test(token);
   -  const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
   -  const tokenType = isApp ? "app" : isInstallation ? "installation" : 
isUserToServer ? "user-to-server" : "oauth";
   -  return {
   -    type: "token",
   -    token: token,
   -    tokenType
   -  };
   -}
   -
   -/**
   - * Prefix token for usage in the Authorization header
   - *
   - * @param token OAuth token or JSON Web Token
   - */
   -function withAuthorizationPrefix(token) {
   -  if (token.split(/\./).length === 3) {
   -    return `bearer ${token}`;
   -  }
   -
   -  return `token ${token}`;
   -}
   -
   -async function hook(token, request, route, parameters) {
   -  const endpoint = request.endpoint.merge(route, parameters);
   -  endpoint.headers.authorization = withAuthorizationPrefix(token);
   -  return request(endpoint);
   -}
   -
   -const createTokenAuth = function createTokenAuth(token) {
   -  if (!token) {
   -    throw new Error("[@octokit/auth-token] No token passed to 
createTokenAuth");
   -  }
   -
   -  if (typeof token !== "string") {
   -    throw new Error("[@octokit/auth-token] Token passed to createTokenAuth 
is not a string");
   -  }
   -
   -  token = token.replace(/^(token|bearer) +/i, "");
   -  return Object.assign(auth.bind(null, token), {
   -    hook: hook.bind(null, token)
   -  });
   -};
   -
   -exports.createTokenAuth = createTokenAuth;
   -//# sourceMappingURL=index.js.map
   -
   -
    /***/ }),
    
    /***/ 76762:
   @@ -7152,7 +7089,7 @@ var import_universal_user_agent = 
__nccwpck_require__(45030);
    var import_before_after_hook = __nccwpck_require__(83682);
    var import_request = __nccwpck_require__(36234);
    var import_graphql = __nccwpck_require__(76442);
   -var import_auth_token = __nccwpck_require__(40334);
   +var import_auth_token = __nccwpck_require__(55542);
    
    // pkg/dist-src/version.js
    var VERSION = "4.2.4";
   @@ -7280,6 +7217,69 @@ Octokit.plugins = [];
    0 && (0);
    
    
   +/***/ }),
   +
   +/***/ 55542:
   +/***/ ((__unused_webpack_module, exports) => {
   +
   +"use strict";
   +
   +
   +Object.defineProperty(exports, "__esModule", ({ value: true }));
   +
   +const REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
   +const REGEX_IS_INSTALLATION = /^ghs_/;
   +const REGEX_IS_USER_TO_SERVER = /^ghu_/;
   +async function auth(token) {
   +  const isApp = token.split(/\./).length === 3;
   +  const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || 
REGEX_IS_INSTALLATION.test(token);
   +  const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
   +  const tokenType = isApp ? "app" : isInstallation ? "installation" : 
isUserToServer ? "user-to-server" : "oauth";
   +  return {
   +    type: "token",
   +    token: token,
   +    tokenType
   +  };
   +}
   +
   +/**
   + * Prefix token for usage in the Authorization header
   + *
   + * @param token OAuth token or JSON Web Token
   + */
   +function withAuthorizationPrefix(token) {
   +  if (token.split(/\./).length === 3) {
   +    return `bearer ${token}`;
   +  }
   +
   +  return `token ${token}`;
   +}
   +
   +async function hook(token, request, route, parameters) {
   +  const endpoint = request.endpoint.merge(route, parameters);
   +  endpoint.headers.authorization = withAuthorizationPrefix(token);
   +  return request(endpoint);
   +}
   +
   +const createTokenAuth = function createTokenAuth(token) {
   +  if (!token) {
   +    throw new Error("[@octokit/auth-token] No token passed to 
createTokenAuth");
   +  }
   +
   +  if (typeof token !== "string") {
   +    throw new Error("[@octokit/auth-token] Token passed to createTokenAuth 
is not a string");
   +  }
   +
   +  token = token.replace(/^(token|bearer) +/i, "");
   +  return Object.assign(auth.bind(null, token), {
   +    hook: hook.bind(null, token)
   +  });
   +};
   +
   +exports.createTokenAuth = createTokenAuth;
   +//# sourceMappingURL=index.js.map
   +
   +
    /***/ }),
    
    /***/ 76442:
   
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to