Skip to content

Commit

Permalink
Add summary and url on job card github-script-poc.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
daveboster authored Nov 24, 2023
1 parent 201e050 commit bec17ad
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/github-script-poc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
poc-test:
runs-on: ubuntu-latest
name: Sandbox Testing
environment:
name: 'Production'
url: ${{ steps.deploy-website.outputs.deployment_url }}

steps:
# - name: View context attributes
# uses: actions/github-script@v7
Expand All @@ -21,7 +25,7 @@ jobs:

- name: Create Sample GitHub Deployment
uses: actions/github-script@v4
id: create_github_deployment
id: github-deployment-create
with:
script: |
const deployment = await github.repos.createDeployment({
Expand All @@ -43,22 +47,31 @@ jobs:
throw new Error(`Failed to create deployment: ${deployment.status}`);
}
- name: Deployment
id: deploy-website
run: echo "deployment_url=${{ environment_url }}" >> "$GITHUB_OUTPUT"

- name: Create Sample Deployment Status (completed)
uses: actions/github-script@v4
id: create_github_deployment_status_completed
id: github-deployment-completed
with:
script: |
let deploymentId = "${{ steps.get_deployment.outputs.id }}";
let environmentUrl = "${{ steps.get_deployment.outputs.url }}";
const deploymentStatus = await github.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: "${{ steps.create_github_deployment.outputs.id }}",
deployment_id: "${{ steps.github-deployment-create.outputs.id }}",
state: 'success',
log_url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
description: "${{ env.deployment_description }}",
environment_url: "${{ env.environment_url }}",
environment: "${{ env.project_name }}-${{ env.environment_name }}",
production_environment: ${{ env.is_production }}
});
- name: Generate Deployment Summary
run: |
echo "This is the lead in sentence for the list" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
echo "- Lets add a bullet point" >> $GITHUB_STEP_SUMMARY
echo "- Lets add a second bullet point" >> $GITHUB_STEP_SUMMARY
echo "- How about a third one?" >> $GITHUB_STEP_SUMMARY

0 comments on commit bec17ad

Please sign in to comment.