-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the new wptmetadata-bot for manifest updates #4115
Conversation
Problem 1: New autoapprove job cannot infer the PR that started it The new bot ran into some problems upon initial rollout. It is meant to use the principle of least privilege. This helpful for non-verified actions. More about it here: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork During the rollout, it was discovered that the new workflow_run actually does not have access to which pull request it came from. (There will initial attempts to read from the event payload but it failed). GitHub itself documents how to get the PR information to the subsequent workflows: - https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ This commit implements that solutions. Implementation based on what GitHub suggested: - Save the PR number in test.yml - use the PR number in auto-approve.yml Problem 2: automerge workflow does not work with forked contributions Forks do not have access to repository secrets during the following events (which the automerge workflow uses): - pull_request - pull_request_review As a result, the automerge workflow will not work on this. We get around this by now using the now built in GitHub auto merge feature. By enabling it, it does not enable auto merge for PRs. Instead, it presents the option that developers to enable automerge. If enabled, PRs will auto merge once the branch protection rules are fulfilled. Implementation: - Modified the update_wpt_manifest with a separate job which will enable auto merge once it is created. - Added a note to the pull request template about human developers not using the automerge feature. --- Requirements after this is merged: - Enable the option for contributors to enable auto-merge - Human developers should not use it and there has been a note added to the PR template. - Recreate the fork for wptmetadata-bot - Keep the branch requirement that a reviewer must approve and that the "test" action must pass
Example of this working: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thoroughly explained change as always. 🙂
script: | | ||
console.log("Starting to list artifacts"); | ||
var artifacts = await github.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
console.log("Filtering artifacts"); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr_number" | ||
})[0]; | ||
console.log("Downloading artifacts"); | ||
var download = await github.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
console.log("Writing artifacts to disk"); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could possibly be stored in a separate file, which might make it easier to edit if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something to consider in the future. The action would need to check out the repository first then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment - hope to see if there is an easier way to store/pass the PR numbers between workflows in the future. It would reduce the complexity of the code greatly
I agree. I tried to print out the event data just to triple check out the raw event to see if the pull request number was there. I printed the full github.event with ExpandLogs{
"action": "completed",
"repository": {
"allow_forking": true,
"archive_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/{archive_format}{/ref}](https://api.github.com/repos/jcscottiii/wpt-metadata/%7Barchive_format%7D%7B/ref%7D)",
"archived": false,
"assignees_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/assignees{/user}](https://api.github.com/repos/jcscottiii/wpt-metadata/assignees%7B/user%7D)",
"blobs_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/git/blobs{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/git/blobs%7B/sha%7D)",
"branches_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/branches{/branch}](https://api.github.com/repos/jcscottiii/wpt-metadata/branches%7B/branch%7D)",
"clone_url": "https://github.com/jcscottiii/wpt-metadata.git",
"collaborators_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/collaborators{/collaborator}](https://api.github.com/repos/jcscottiii/wpt-metadata/collaborators%7B/collaborator%7D)",
"comments_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/comments{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/comments%7B/number%7D)",
"commits_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/commits{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/commits%7B/sha%7D)",
"compare_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/compare/{base}...{head}](https://api.github.com/repos/jcscottiii/wpt-metadata/compare/%7Bbase%7D...%7Bhead%7D)",
"contents_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/contents/{+path}](https://api.github.com/repos/jcscottiii/wpt-metadata/contents/%7B+path%7D)",
"contributors_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/contributors",
"created_at": "2023-04-27T14:15:11Z",
"default_branch": "master",
"deployments_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/deployments",
"description": "Out-of-tree metadata for wpt",
"disabled": false,
"downloads_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/downloads",
"events_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/events",
"fork": true,
"forks": 1,
"forks_count": 1,
"forks_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/forks",
"full_name": "jcscottiii/wpt-metadata",
"git_commits_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/git/tags{/sha}",
"git_url": "git://github.com/jcscottiii/wpt-metadata.git",
"has_discussions": false,
"has_downloads": true,
"has_issues": false,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": null,
"hooks_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/hooks",
"html_url": "https://github.com/jcscottiii/wpt-metadata",
"id": 633447980,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/issues/events{/number}",
"issues_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/issues{/number}",
"keys_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/keys{/key_id}",
"labels_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/labels{/name}",
"language": "Go",
"languages_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/languages",
"license": null,
"merges_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/merges",
"milestones_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/milestones{/number}",
"mirror_url": null,
"name": "wpt-metadata",
"node_id": "R_kgDOJcGmLA",
"notifications_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/notifications{?since,all,participating}",
"open_issues": 1,
"open_issues_count": 1,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/7788930?v=4",
"events_url": "https://api.github.com/users/jcscottiii/events{/privacy}",
"followers_url": "https://api.github.com/users/jcscottiii/followers",
"following_url": "https://api.github.com/users/jcscottiii/following{/other_user}",
"gists_url": "https://api.github.com/users/jcscottiii/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/jcscottiii",
"id": 7788930,
"login": "jcscottiii",
"node_id": "MDQ6VXNlcjc3ODg5MzA=",
"organizations_url": "https://api.github.com/users/jcscottiii/orgs",
"received_events_url": "https://api.github.com/users/jcscottiii/received_events",
"repos_url": "https://api.github.com/users/jcscottiii/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/jcscottiii/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jcscottiii/subscriptions",
"type": "User",
"url": "https://api.github.com/users/jcscottiii"
},
"private": false,
"pulls_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/pulls{/number}",
"pushed_at": "2023-04-27T19:53:44Z",
"releases_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/releases{/id}",
"size": 47543,
"ssh_url": "git@github.com:jcscottiii/wpt-metadata.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/stargazers",
"statuses_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/subscribers",
"subscription_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/subscription",
"svn_url": "https://github.com/jcscottiii/wpt-metadata",
"tags_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/tags",
"teams_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/git/trees{/sha}",
"updated_at": "2023-04-27T14:28:16Z",
"url": "https://api.github.com/repos/jcscottiii/wpt-metadata",
"visibility": "public",
"watchers": 0,
"watchers_count": 0,
"web_commit_signoff_required": false
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/u/131815749?v=4",
"events_url": "https://api.github.com/users/wptmetadata-bot/events{/privacy}",
"followers_url": "https://api.github.com/users/wptmetadata-bot/followers",
"following_url": "https://api.github.com/users/wptmetadata-bot/following{/other_user}",
"gists_url": "https://api.github.com/users/wptmetadata-bot/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/wptmetadata-bot",
"id": 131815749,
"login": "wptmetadata-bot",
"node_id": "U_kgDOB9tZRQ",
"organizations_url": "https://api.github.com/users/wptmetadata-bot/orgs",
"received_events_url": "https://api.github.com/users/wptmetadata-bot/received_events",
"repos_url": "https://api.github.com/users/wptmetadata-bot/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/wptmetadata-bot/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/wptmetadata-bot/subscriptions",
"type": "User",
"url": "https://api.github.com/users/wptmetadata-bot"
},
"workflow": {
"badge_url": "https://github.com/jcscottiii/wpt-metadata/workflows/test/badge.svg",
"created_at": "2023-04-27T14:15:55.000Z",
"html_url": "https://github.com/jcscottiii/wpt-metadata/blob/master/.github/workflows/test.yml",
"id": 55612634,
"name": "test",
"node_id": "W_kwDOJcGmLM4DUJTa",
"path": ".github/workflows/test.yml",
"state": "active",
"updated_at": "2023-04-27T14:15:55.000Z",
"url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/workflows/55612634"
},
"workflow_run": {
"actor": {
"avatar_url": "https://avatars.githubusercontent.com/u/131815749?v=4",
"events_url": "https://api.github.com/users/wptmetadata-bot/events{/privacy}",
"followers_url": "https://api.github.com/users/wptmetadata-bot/followers",
"following_url": "https://api.github.com/users/wptmetadata-bot/following{/other_user}",
"gists_url": "https://api.github.com/users/wptmetadata-bot/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/wptmetadata-bot",
"id": 131815749,
"login": "wptmetadata-bot",
"node_id": "U_kgDOB9tZRQ",
"organizations_url": "https://api.github.com/users/wptmetadata-bot/orgs",
"received_events_url": "https://api.github.com/users/wptmetadata-bot/received_events",
"repos_url": "https://api.github.com/users/wptmetadata-bot/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/wptmetadata-bot/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/wptmetadata-bot/subscriptions",
"type": "User",
"url": "https://api.github.com/users/wptmetadata-bot"
},
"artifacts_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/482[378](https://github.com/jcscottiii/wpt-metadata/actions/runs/4823875760/jobs/8592937079#step:6:379)7958/artifacts",
"cancel_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/4823787958/cancel",
"check_suite_id": 12535117235,
"check_suite_node_id": "CS_kwDOJcGmLM8AAAAC6ya1sw",
"check_suite_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/check-suites/12535117235",
"conclusion": "success",
"created_at": "2023-04-27T19:43:43Z",
"display_title": "Update latest WPT Manifest for go_test",
"event": "pull_request",
"head_branch": "actions/wpt-manifest",
"head_commit": {
"author": {
"email": "jcscottiii@users.noreply.github.com",
"name": "jcscottiii"
},
"committer": {
"email": "noreply@github.com",
"name": "GitHub"
},
"id": "e041d1729da11ae145f4e08d2ac3c334345357e2",
"message": "Run curl -s -S https://wpt.fyi/api/manifest?sha=latest >> go_test/MANIFEST.json",
"timestamp": "2023-04-27T19:43:18Z",
"tree_id": "e6fd15a48a0726a0a2bfd5bd2ffae01c05c6a0ff"
},
"head_repository": {
"archive_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/assignees{/user}",
"blobs_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/comments{/number}",
"commits_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/commits{/sha}",
"compare_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/contents/{+path}",
"contributors_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/contributors",
"deployments_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/deployments",
"description": "Out-of-tree metadata for wpt",
"downloads_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/downloads",
"events_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/events",
"fork": true,
"forks_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/forks",
"full_name": "wptmetadata-bot/wpt-metadata",
"git_commits_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/git/tags{/sha}",
"hooks_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/hooks",
"html_url": "https://github.com/wptmetadata-bot/wpt-metadata",
"id": 633451788,
"issue_comment_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/issues/events{/number}",
"issues_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/issues{/number}",
"keys_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/keys{/key_id}",
"labels_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/labels{/name}",
"languages_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/languages",
"merges_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/merges",
"milestones_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/milestones{/number}",
"name": "wpt-metadata",
"node_id": "R_kgDOJcG1DA",
"notifications_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/notifications{?since,all,participating}",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/131815749?v=4",
"events_url": "https://api.github.com/users/wptmetadata-bot/events{/privacy}",
"followers_url": "https://api.github.com/users/wptmetadata-bot/followers",
"following_url": "https://api.github.com/users/wptmetadata-bot/following{/other_user}",
"gists_url": "https://api.github.com/users/wptmetadata-bot/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/wptmetadata-bot",
"id": 131815749,
"login": "wptmetadata-bot",
"node_id": "U_kgDOB9tZRQ",
"organizations_url": "https://api.github.com/users/wptmetadata-bot/orgs",
"received_events_url": "https://api.github.com/users/wptmetadata-bot/received_events",
"repos_url": "https://api.github.com/users/wptmetadata-bot/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/wptmetadata-bot/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/wptmetadata-bot/subscriptions",
"type": "User",
"url": "https://api.github.com/users/wptmetadata-bot"
},
"private": false,
"pulls_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/pulls{/number}",
"releases_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/releases{/id}",
"stargazers_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/stargazers",
"statuses_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/subscribers",
"subscription_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/subscription",
"tags_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/tags",
"teams_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/teams",
"trees_url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata/git/trees{/sha}",
"url": "https://api.github.com/repos/wptmetadata-bot/wpt-metadata"
},
"head_sha": "e041d1729da11ae145f4e08d2ac3c334345357e2",
"html_url": "https://github.com/jcscottiii/wpt-metadata/actions/runs/4823787958",
"id": 4823787958,
"jobs_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/4823787958/jobs",
"logs_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/4823787958/logs",
"name": "test",
"node_id": "WFR_kwLOJcGmLM8AAAABH4Uptg",
"path": ".github/workflows/test.yml",
"previous_attempt_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/4823787958/attempts/4",
"pull_requests": [],
"referenced_workflows": [],
"repository": {
"archive_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/assignees{/user}",
"blobs_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/comments{/number}",
"commits_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/commits{/sha}",
"compare_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/contents/{+path}",
"contributors_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/contributors",
"deployments_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/deployments",
"description": "Out-of-tree metadata for wpt",
"downloads_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/downloads",
"events_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/events",
"fork": true,
"forks_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/forks",
"full_name": "jcscottiii/wpt-metadata",
"git_commits_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/git/commits{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/git/commits%7B/sha%7D)",
"git_refs_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/git/refs{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/git/refs%7B/sha%7D)",
"git_tags_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/git/tags{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/git/tags%7B/sha%7D)",
"hooks_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/hooks",
"html_url": "https://github.com/jcscottiii/wpt-metadata",
"id": 633447980,
"issue_comment_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/issues/comments{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/issues/comments%7B/number%7D)",
"issue_events_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/issues/events{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/issues/events%7B/number%7D)",
"issues_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/issues{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/issues%7B/number%7D)",
"keys_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/keys{/key_id}](https://api.github.com/repos/jcscottiii/wpt-metadata/keys%7B/key_id%7D)",
"labels_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/labels{/name}](https://api.github.com/repos/jcscottiii/wpt-metadata/labels%7B/name%7D)",
"languages_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/languages",
"merges_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/merges",
"milestones_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/milestones{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/milestones%7B/number%7D)",
"name": "wpt-metadata",
"node_id": "R_kgDOJcGmLA",
"notifications_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/notifications{?since](https://api.github.com/repos/jcscottiii/wpt-metadata/notifications%7B?since),all,participating}",
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/7788930?v=4",
"events_url": "[https://api.github.com/users/jcscottiii/events{/privacy}](https://api.github.com/users/jcscottiii/events%7B/privacy%7D)",
"followers_url": "https://api.github.com/users/jcscottiii/followers",
"following_url": "[https://api.github.com/users/jcscottiii/following{/other_user}](https://api.github.com/users/jcscottiii/following%7B/other_user%7D)",
"gists_url": "[https://api.github.com/users/jcscottiii/gists{/gist_id}](https://api.github.com/users/jcscottiii/gists%7B/gist_id%7D)",
"gravatar_id": "",
"html_url": "https://github.com/jcscottiii",
"id": 7788930,
"login": "jcscottiii",
"node_id": "MDQ6VXNlcjc3ODg5MzA=",
"organizations_url": "https://api.github.com/users/jcscottiii/orgs",
"received_events_url": "https://api.github.com/users/jcscottiii/received_events",
"repos_url": "https://api.github.com/users/jcscottiii/repos",
"site_admin": false,
"starred_url": "[https://api.github.com/users/jcscottiii/starred{/owner}{/repo}](https://api.github.com/users/jcscottiii/starred%7B/owner%7D%7B/repo%7D)",
"subscriptions_url": "https://api.github.com/users/jcscottiii/subscriptions",
"type": "User",
"url": "https://api.github.com/users/jcscottiii"
},
"private": false,
"pulls_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/pulls{/number}](https://api.github.com/repos/jcscottiii/wpt-metadata/pulls%7B/number%7D)",
"releases_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/releases{/id}](https://api.github.com/repos/jcscottiii/wpt-metadata/releases%7B/id%7D)",
"stargazers_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/stargazers",
"statuses_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/statuses/{sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/statuses/%7Bsha%7D)",
"subscribers_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/subscribers",
"subscription_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/subscription",
"tags_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/tags",
"teams_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/teams",
"trees_url": "[https://api.github.com/repos/jcscottiii/wpt-metadata/git/trees{/sha}](https://api.github.com/repos/jcscottiii/wpt-metadata/git/trees%7B/sha%7D)",
"url": "https://api.github.com/repos/jcscottiii/wpt-metadata"
},
"rerun_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/4823787958/rerun",
"run_attempt": 5,
"run_number": 40,
"run_started_at": "2023-04-27T19:55:01Z",
"status": "completed",
"triggering_actor": {
"avatar_url": "https://avatars.githubusercontent.com/u/7788930?v=4",
"events_url": "https://api.github.com/users/jcscottiii/events{/privacy}",
"followers_url": "https://api.github.com/users/jcscottiii/followers",
"following_url": "https://api.github.com/users/jcscottiii/following{/other_user}",
"gists_url": "https://api.github.com/users/jcscottiii/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/jcscottiii",
"id": 7788930,
"login": "jcscottiii",
"node_id": "MDQ6VXNlcjc3ODg5MzA=",
"organizations_url": "https://api.github.com/users/jcscottiii/orgs",
"received_events_url": "https://api.github.com/users/jcscottiii/received_events",
"repos_url": "https://api.github.com/users/jcscottiii/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/jcscottiii/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/jcscottiii/subscriptions",
"type": "User",
"url": "https://api.github.com/users/jcscottiii"
},
"updated_at": "2023-04-27T19:56:18Z",
"url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/runs/[482](https://github.com/jcscottiii/wpt-metadata/actions/runs/4823875760/jobs/8592937079#step:6:483)3787958",
"workflow_id": 55612634,
"workflow_url": "https://api.github.com/repos/jcscottiii/wpt-metadata/actions/workflows/55612634"
}
} |
Problem 1: New autoapprove job cannot infer the PR that started it
The new bot ran into some problems upon initial rollout. It is meant to use the principle of least privilege. This helpful for non-verified actions. More about it here: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork
During the rollout, it was discovered that the new workflow_run actually does not have access to which pull request it came from. (There will initial attempts to read from the event payload but it failed).
GitHub itself documents how to get the PR information to the subsequent workflows:
This commit implements that solutions.
Implementation based on what GitHub suggested:
Problem 2: automerge workflow does not work with forked contributions
Forks do not have access to repository secrets during the following events (which the automerge workflow uses):
As a result, the automerge workflow will not work on this. We get around this by now using the now built in GitHub auto merge feature. By enabling it, it does not enable auto merge for PRs. Instead, it presents the option that developers to enable automerge. If enabled, PRs will auto merge once the branch protection rules are fulfilled.
Implementation:
Requirements after this is merged: