豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 5497ef9

Browse files
gkalpakdevversion
authored andcommitted
fix(github-actions): use GitHub PAT instead of GitHub App key in create-pr-for-changes
Using the GitHub App key for Angular Robot does not retrieving a fork to create PRs from. Switching to using a GitHub Personal Access Token in order to be able to create PRs from a fork and not pollute the upstream branches.
1 parent 639ed26 commit 5497ef9

File tree

4 files changed

+80
-7633
lines changed

4 files changed

+80
-7633
lines changed

github-actions/create-pr-for-changes/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ inputs:
6565
To skip the automatic clean up of obsolete branches, set this option to `false`.
6666
6767
Example: `clean-up-branches: false`
68-
angular-robot-key:
68+
angular-robot-token:
6969
required: true
70-
description: The private key for the Angular Robot Github app. Used to authenticate with GitHub.
70+
description: A GitHub access token for Angular Robot. Used to authenticate with GitHub.
7171

7272
outputs:
7373
result:

github-actions/create-pr-for-changes/lib/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ts_library(
1313
exclude = ["*.spec.ts"],
1414
),
1515
deps = [
16-
"//github-actions:utils",
1716
"//ng-dev/utils",
1817
"@npm//@actions/core",
1918
"@npm//@actions/github",

github-actions/create-pr-for-changes/lib/main.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {GithubConfig, setConfig} from '../../../ng-dev/utils/config.js';
66
import {AuthenticatedGitClient} from '../../../ng-dev/utils/git/authenticated-git-client.js';
77
import {GithubRepo} from '../../../ng-dev/utils/git/github.js';
88
import {getRepositoryGitUrl} from '../../../ng-dev/utils/git/github-urls.js';
9-
import {ANGULAR_ROBOT, getAuthTokenFor, revokeActiveInstallationToken} from '../../utils.js';
109

1110
const enum ActionResult {
1211
created = 'created',
@@ -18,8 +17,6 @@ main();
1817

1918
// Helpers
2019
async function main(): Promise<void> {
21-
let authToken: string | null = null;
22-
2320
try {
2421
// Initialize outputs.
2522
core.setOutput('result', ActionResult.nothing);
@@ -35,10 +32,10 @@ async function main(): Promise<void> {
3532
};
3633
setConfig(config);
3734

38-
// Configure the `AuthenticatedGitClient` to be authenticated with the token for the Angular
39-
// Robot.
40-
authToken = await getAuthTokenFor(ANGULAR_ROBOT);
41-
AuthenticatedGitClient.configure(authToken);
35+
// Configure the `AuthenticatedGitClient` to be authenticated with the provided GitHub access
36+
// token for Angular Robot.
37+
const accessToken = core.getInput('angular-robot-token', {required: true});
38+
AuthenticatedGitClient.configure(accessToken);
4239
/** The authenticated GitClient. */
4340
const git = await AuthenticatedGitClient.get();
4441
git.run(['config', 'user.email', 'angular-robot@google.com']);
@@ -206,10 +203,6 @@ async function main(): Promise<void> {
206203
core.setOutput('result', ActionResult.failed);
207204
core.error(err);
208205
core.setFailed(err.message);
209-
} finally {
210-
if (authToken !== null) {
211-
await revokeActiveInstallationToken(authToken);
212-
}
213206
}
214207
}
215208

0 commit comments

Comments
 (0)