name: newrelic deployment history
author: Bolt lee
inputs:
  NR_APM_ID:
    description: 'newrelic app id'
    required: false
    default: ''
  NR_REST_KEY:
    description: 'newrelic account rest key'
    required: false
    default: ''
runs:
  using: "composite"
  steps:
  - name: Deployment history
    shell: bash
    run: |
      curl -X POST "https://api.newrelic.com/v2/applications/${{ inputs.NR_APM_ID }}/deployments.json" \
          -H "X-Api-Key:${{ inputs.NR_REST_KEY }}" \
          -i \
          -H "Content-Type: application/json" \
          -d \
          "{
            \"deployment\": {
              \"revision\": \"${{ github.sha }}\",
              \"user\": \"${{ github.actor }}\"
              }
          }"
      echo "deployed image: ${{ github.sha }}"