Skip to content
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

File Based Post Deploy Messages #174

Merged
merged 37 commits into from
Jul 28, 2023
Merged

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Jul 27, 2023

File Based Post Deploy Messages

This pull request enables the option for "file based" custom post deploy messages.

By enabling this, users of this Action should be fully shielded from the issue that persists on GitHub Action runners where env vars containing a lot of data cause things to go 💥 (#173).

This will also allow users to have complete, and full control over how their post deploy messages look and it will be in markdown format as well which is a huge bonus.


Usage 💻

This pull request introduces a new input parameter for this Action:

  • deploy_message_path - The path to a markdown file which is used as a template for custom deployment messages. Example: ".github/deployment_message.md"

By default, this Action will now look for a file at the deploy_message_path path. If the file exists, it will be used and rendered with nunjucks which is a Jinja like templating engine for NodeJS. If the file does not exist, then the default deploy comment process will take place which will be familiar for all users of this Action. If the DEPLOY_MESSAGE env var is set, that will still be used, otherwise the default message structure is used. So the order of operations for the deployment comment that appears on PRs is now as follows:

  1. Custom deploy_message_path file is used and rendered via nunjucks
  2. The DEPLOY_MESSAGE env var is read and injected into the default comment body structure
  3. The default comment body structure is used "as-is"

The deploy_message_path file should be a markdown file by convention and since it gets rendered with nunjucks, a few helpful variables are available out of the box for you to use and to help structure your messages with.

  • environment - The name of the environment (String)
  • environment_url - The URL of the environment (String) {Optional}
  • status - The status of the deployment (String) - success, failure, or unknown
  • noop - Whether or not the deployment is a noop (Boolean)
  • ref - The ref of the deployment (String)
  • actor - The GitHub username of the actor who triggered the deployment (String)

You can also view the template file used in unit tests which is self-documenting


Tangentially related: #173

@GrantBirki GrantBirki added the enhancement New feature or request label Jul 27, 2023
@GrantBirki GrantBirki self-assigned this Jul 27, 2023
@GrantBirki
Copy link
Member Author

The "temp" file path works and it even works in our post deploy step which is extremely important 🎉

https://github.com/GrantBirki/actions-sandbox/actions/runs/5679902586/job/15392952016#step:12:27

Acceptance testing was done here: GrantBirki/actions-sandbox#55

@GrantBirki GrantBirki marked this pull request as ready for review July 27, 2023 21:36
jasonmacgowan
jasonmacgowan previously approved these changes Jul 27, 2023
@GrantBirki GrantBirki merged commit 8bfe76a into main Jul 28, 2023
4 checks passed
@GrantBirki GrantBirki deleted the file-based-post-deploy-messages branch July 28, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants