Dashboard › publish › Distillation
52d910bb-d9e0-41c7-b32d-cd7e1ac164bf["lore_tm_v1__ZOBjHVkX2VyC3NlKcBGOi74pel7Ggj1BnjUdqxebM0","lore_tm_v1_zzyeO1bjXFAY6FfqxPJJUuH734tF0ugQU6OWqIu6IxA","lore_tm_v1_ADhHhundMmhkOABNlAVsTaPIUn1Q6-AfwFS0DKYl9YM","lore_tm_v1_GufuOssurcNH_PxQJo4ANs_ULR2oxH8MOkLr5OZUahc","lore_tm_v1_j7aLgRnkQ-a_UGM-BpA6WZEjbEC9xoigrvmfIQXEh10","lore_tm_v1_N7KGmo8o1zDYnHlwRskfhXWblqpenLFkqwMtoX6w0s0"]
src/modules/__tests__/update-issue.js configures GITHUB_WORKSPACE="." and CRAFT_STATE_FILE_PATH=".craft-state/craft/publish-state-getsentry-sentry-c232c383e26f-21.3.1.json"; mocked state-file content is {"published":{"lol":true,"hey":false,"github":true}}.src/modules/__tests__/update-issue.js tests updateIssue() for both state-file-present and state-file-absent cases. In each case, fs.existsSync is called exactly once with .craft-state/craft/publish-state-getsentry-sentry-c232c383e26f-21.3.1.json.updateIssue() test expects issue 211 from getsentry/publish to be fetched and updated; the resulting body contains - [x] github, - [ ] pypi, - [x] lol, and - [ ] hey.src/modules/__tests__/update-issue.js expects the issue body not to be updated.updateIssue() is expected to remove label accepted from issue 211 in getsentry/publish.src/modules/__tests__/update-issue.js verifies that when target setup was skipped and CRAFT_STATE_FILE_PATH is absent, updateIssue() neither calls fs.existsSync nor updates the issue body.src/modules/__tests__/update-issue.js verifies updateIssue() can run without parsed publish inputs: it does not inspect a state file, fetch the issue, or update the body, but still removes accepted from issue 211 in getsentry/publish.transformIssueBody() test supplies publish state in insertion order: npm[@sentry/node]: true, aws-lambda: true, github: false, and unlisted target foo: true. It expects the Targets section to become, in order: - [x] npm[@sentry/node], - [x] aws-lambda, - [ ] github, and - [x] foo, while preserving the surrounding issue content and explanatory footer.src/modules/update-issue.js defines updateTargets({ octokit, stateFilePath, publishRepo, issue_number }); it returns immediately if stateFilePath is absent or fs.existsSync(stateFilePath) is false.updateTargets() concurrently fetches the issue through octokit.rest.issues.get({...publishRepo, issue_number}) and reads the state file as UTF-8 through fs.promises.readFile(stateFilePath, { encoding: "utf-8" }), parsing the latter with JSON.parse.updateTargets() calls transformIssueBody(craftState, issue.body) and updates the issue through octokit.rest.issues.update({...publishRepo, issue_number, body: newIssueBody}).transformIssueBody(craftState, issueBody) uses TARGETS_SECTION_PARSER_REGEX to replace the Targets section and TARGETS_PARSER_REGEX to process each declared target. It tracks declared target IDs in a Set, marks each target [x] when craftState.published[targetId] is truthy and [ ] otherwise, and normalizes each checkbox line to - [<mark>] <targetId>.transformIssueBody() applies trimEnd() to the matched Targets section, then appends every key in craftState.published not already present in the issue. Unlisted targets retain Object.keys(craftState.published) order and are rendered with state-derived checked or unchecked boxes.updateIssue({ context, octokit }) derives publishRepo from context.repo and issue_number from context.payload.issue.number, then concurrently runs updateTargets() using process.env.CRAFT_STATE_FILE_PATH and removes the accepted label with octokit.rest.issues.removeLabel.src/modules/update-issue.js exports exactly { updateIssue, transformIssueBody }; updateTargets() remains internal.src/libs/__tests__/github.js tests getGitHubToken(): without GITHUB_TOKEN, it throws exactly No "GITHUB_TOKEN" environment variable found.; with GITHUB_TOKEN="Example Token", it returns "Example Token".src/modules/__tests__/post-workflow-details.js verifies postWorkflowDetails() creates exactly one comment on issue 211 in getsentry/publish with body Publishing: [run#1234](https://github.com/getsentry/sentry/actions/runs/1234), using the workflow URL returned by getWorkflowRun.