Add deployment summary to the job summary and pull request comment#279
Open
chhateauuu wants to merge 10 commits into
Open
Add deployment summary to the job summary and pull request comment#279chhateauuu wants to merge 10 commits into
chhateauuu wants to merge 10 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
sql-actiondeploys a database, the details of what actually changed are only visible in the build logs. A reviewer sees a green check and has to open the run and read the logs to learn what happened to the database.This PR makes the action publish a concise deployment summary of what the deployment changed. It is written to the GitHub Actions job summary and, on pull requests, posted as a single auto-updating sticky comment. It reports the objects created, altered, and dropped, warns about possible data loss, and includes the full deployment T-SQL in a collapsible section.
The information already exists: SqlPackage computes the change set during every publish. This PR captures the deployment report and script it produces, parses them, formats a summary, and publishes it. No deployment logic is added or changed.
code-walkthrough.md
What it looks like
On a pull request that changes the schema, the action posts a summary like this:
What changed
src/DeploymentReport.ts: parses the SqlPackage deployment report XML into operations and alerts. Tolerant of missing or malformed input.src/DeploymentSummary.ts: a pure function that renders the summary Markdown.src/Reporter.ts: writes the job summary, posts or updates the sticky PR comment, and sets outputs. Best-effort; it can never fail a deployment.src/AzureSqlAction.ts: during a Publish, captures the deployment report and script (respecting any caller-supplied paths) and returns their locations.src/main.ts: measures the deploy duration and invokes the reporter after a successful deploy.action.ymlandREADME.md: document the new inputs and outputs.The change is organized into small, logical commits so it can be reviewed step by step.
New inputs (all optional)
summarytruecomment-prautooff,auto,always.github-token${{ github.token }}New outputs
changes-detected,objects-changed,deployment-report-path,deployment-script-path.Behavior and safety
pull-requests: write. When the token or permission is missing, the action logs a warning and falls back to the job summary.Compatibility notes
fast-xml-parser(report parsing) and@actions/github(comment posting).@actions/githubis pinned to the v6 CommonJS line for compatibility with the existing webpack build.lib/main.jsgrows from about 284 KB to 860 KB, driven mainly by the GitHub API client.comment-prdefaults toauto. If a more conservative default is preferred, it can default tooff(opt-in). This is a one-line change; happy to adjust.Testing
npm run buildsucceeds and the committed bundle is up to date.