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

Add ability to provide description for deploys #37

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ The following table lists the configuration options for the Deploy to Astro acti

| Name | Default | Description |
| ---|---|--- |
| `action` | `deploy` | Specify what action you would like to take. Use this option to create or delete deployment previews. Specify either `create-deployment-preview`, `delete-deployment-preview` or `deploy-deployment-preview`. Don't specify anything if you are deploying to a regular deployment |
| `deployment-id` | `false` | Specifies the id of the deployment you want to make a preview from or are deploying too |
| `deployment-name` | `false` | Specifies the name of the deployment you want to make preview from or are deploying too. Cannot be used in combination with `deployment-id` |
| `action` | `deploy` | Specify what action you would like to take. Use this option to create or delete deployment previews. Specify either `create-deployment-preview`, `delete-deployment-preview` or `deploy-deployment-preview`. Don't sepcify anything if you are deploying to a regular deployment |
| `deployment-id` | `false` | Specifies the id of the deployment you to make a preview from or are deploying too |
| `deployment-name` | `false` | Specifies The name of the deployment you want to make preview from or are deploying too. Cannot be used with `deployment-id` |
| `description` | | Configure a description for a deploy to Astro. Description will be visible in the Deploy History tab. |
| `root-folder` | `.` | Specifies the path to the Astro project directory that contains the `dags` folder |
| `parse` | `false` | When set to `true`, DAGs are parsed for errors before deploying to Astro |
| `pytest` | `false` | When set to `true`, all pytests in the `tests` directory of your Astro project are run before deploying to Astro. See [Run tests with pytest](https://docs.astronomer.io/astro/test-and-troubleshoot-locally#run-tests-with-pytest) |
Expand Down
24 changes: 19 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,17 @@ inputs:
checkout:
required: false
default: true
description: "Whether to checkout the repo as the first step. Set this to false if you want to modify repo contents before invoking the action."

description: "Whether to checkout the repo as the first step. Set this to false if you want to modify repo contents before invoking the action"
description:
required: false
description: >
A description to set for deploying to Astro. This is equivalent to running `astro deploy --description "..."` with the Astro CLI.
The description is visible in the Deploy History tab in your Astro Deployment, and can be helpful to explain what triggered a deploy.

For example, to display the most recent commit that resulted in an Astro deploy, you could configure
`description: "Deployed from commit ..."` with the value of `github.event.after`.
This would display e.g. "Deployed from commit da39a3ee5e6b4b0d3255bfef95601890afd80709".
Reference: https://docs.github.com/en/webhooks/webhook-events-and-payloads#push.
outputs:
preview-id:
description: "The ID of the created deployment preview. Only works when action=create-deployment-preview"
Expand All @@ -83,7 +92,7 @@ runs:
# Determine if only DAGs have changes
- name: Install Astro
run: |
curl -sSL https://install.astronomer.io | sudo bash -s ${{ inputs.cli-version }}
curl -sSL https://install.astronomer.io | sudo bash -s ${{ inputs.cli-version }}
shell: bash
- name: Deployment Preview action
run: |
Expand Down Expand Up @@ -119,7 +128,7 @@ runs:

if [[ "${{ inputs.preview-name }}" != "" ]]; then
BRANCH_DEPLOYMENT_NAME="${{ inputs.preview-name }}"
else
else
# get branch name
DEPLOYMENT_NAME="$(astro deployment inspect $DEPLOYMENT_ID --clean-output --key configuration.name)"
if [[ ${GITHUB_HEAD_REF##*/} != "" ]]; then
Expand Down Expand Up @@ -197,7 +206,7 @@ runs:

if [[ "${{ inputs.preview-name }}" != "" ]]; then
BRANCH_DEPLOYMENT_NAME="${{ inputs.preview-name }}"
else
else
DEPLOYMENT_NAME="$(astro deployment inspect $DEPLOYMENT_ID --clean-output --key configuration.name)"
if [[ ${GITHUB_HEAD_REF##*/} != "" ]]; then
BRANCH_DEPLOYMENT_NAME=${GITHUB_HEAD_REF##*/}_$DEPLOYMENT_NAME
Expand Down Expand Up @@ -303,6 +312,11 @@ runs:
options="$options --force"
fi

# Add description option
if [[ "${{ inputs.description }}" != '' ]]; then
options='$options --description "${{ inputs.description }}"'
fi

echo "OPTIONS=$options" >> $GITHUB_OUTPUT
shell: bash
id: deploy-options
Expand Down