Skip to content

Commit eb07b30

Browse files
authored
update and clean up github action (#73)
* update and clean up github action * does it wooorrrk, does it work * use self for testing
1 parent bff6421 commit eb07b30

5 files changed

Lines changed: 41 additions & 47 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ jobs:
1212
test:
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
1517
- name: Report Deploy with Docker
16-
uses: OpsLevel/report-deploy-github-action@${{ github.sha }}
18+
uses: ./
1719
with:
1820
integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }}
1921
service: "report_deploy_github_action"
2022
use_docker: "true"
2123
- name: Report Deploy with CLI
22-
uses: OpsLevel/report-deploy-github-action@${{ github.sha }}
24+
uses: ./
2325
with:
2426
integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }}
2527
service: "report_deploy_github_action"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ The deployer name who created the event - Default: `${GITHUB_ACTOR}`
3636

3737
The deployer email who create the event - Default: ""
3838

39+
### `deploy_url`
40+
41+
The deploy url that OpsLevel points to - Default: `${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`
42+
3943
### `deduplication_id`
4044

4145
An identifier that can be used to deduplicate deployments - Default: `${GITHUB_RUN_ID}`

action.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ inputs:
2020
description: 'The deployer name who created the event'
2121
required: false
2222
default: ${{ github.actor }}
23+
deploy_url:
24+
description: 'The deploy url that OpsLevel points to'
25+
required: false
26+
default: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2327
description:
2428
description: 'The description or release notes for the event'
2529
required: false
@@ -50,6 +54,7 @@ runs:
5054
integration_url: ${{ inputs.integration_url }}
5155
deduplication_id: ${{ inputs.deduplication_id }}
5256
deployer_email: ${{ inputs.deployer_email }}
57+
deploy_url: ${{ inputs.deploy_url }}
5358
deployer_name: ${{ inputs.deployer_name }}
5459
description: ${{ inputs.description }}
5560
environment: ${{ inputs.environment }}
@@ -66,23 +71,16 @@ runs:
6671
run: |
6772
echo ::add-mask::$INTEGRATION_URL
6873
cat <<EOF > data.yaml
69-
service: "$SERVICE"
70-
description": "$DESCRIPTION"
71-
environment": "$ENVIRONMENT"
72-
deploy-number": "$NUMBER"
73-
deploy-url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
74-
dedup-id": "$DEDUPLICATION_ID"
74+
service: "${{ inputs.service }}"
75+
description: "${{ inputs.description }}"
76+
environment: "${{ inputs.environment }}"
77+
deploy-number: "${{ inputs.number }}"
78+
deploy-url: "${{ inputs.deploy_url}}"
79+
dedup-id: "${{ inputs.deduplication_id }}"
7580
deployer:
76-
name: "$DEPLOYER_NAME"
77-
email: "$DEPLOYER_EMAIL"
81+
name: "${{ inputs.deployer_name }}"
82+
email: "${{ inputs.deployer_email }}"
7883
EOF
79-
opslevel create deploy -i "$INTEGRATION_URL" -f .
84+
opslevel create deploy -i "${INTEGRATION_URL}" -f .
8085
env:
81-
DESCRIPTION: ${{ inputs.description }}
82-
DEPLOYER_EMAIL: ${{ inputs.deployer_email }}
83-
DEPLOYER_NAME: ${{ inputs.deployer_name }}
84-
DEDUPLICATION_ID: ${{ inputs.deduplication_id }}
85-
ENVIRONMENT: ${{ inputs.environment }}
8686
INTEGRATION_URL: ${{ inputs.integration_url }}
87-
NUMBER: ${{ inputs.number }}
88-
SERVICE: ${{ inputs.service }}

with-docker/action.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,30 @@ inputs:
88
integration_url:
99
description: 'The OpsLevel deploy integration url'
1010
required: true
11-
default: ''
1211
service:
1312
description: 'The service alias for the event'
14-
required: false
15-
default: ''
13+
required: true
1614
description:
1715
description: 'The description or release notes for the event'
18-
required: false
19-
default: ''
16+
required: true
2017
environment:
2118
description: 'The environment for the event'
22-
required: false
23-
default: ''
19+
required: true
2420
number:
2521
description: 'The deploy number for the event - Default: ${GITHUB_RUN_NUMBER}'
26-
required: false
27-
default: ''
22+
required: true
2823
deployer_name:
2924
description: 'The deployer name who created the event - Default: ${GITHUB_ACTOR}'
30-
required: false
31-
default: ''
25+
required: true
3226
deployer_email:
3327
description: 'The deployer email who created the event'
34-
required: false
35-
default: ''
28+
required: true
29+
deploy_url:
30+
description: 'The deployer email who created the event'
31+
required: true
3632
deduplication_id:
3733
description: 'An identifier that can be used to deduplicate deployments'
38-
required: false
39-
default: ''
34+
required: true
4035
runs:
4136
using: 'docker'
4237
image: 'Dockerfile'

with-docker/entrypoint.sh

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
#!/bin/sh -l
22

3-
OPSLEVEL_FILE=./opslevel.yml
4-
if test -f "$OPSLEVEL_FILE"; then
5-
OPSLEVEL_SERVICE=$(cat ./opslevel.yml | grep "name:" | awk '{gsub("name:",""); print}' | xargs)
6-
fi
7-
83
cat <<EOF > data.yaml
9-
service: "${SERVICE:-${OPSLEVEL_SERVICE}}"
10-
description: "${DESCRIPTION}"
11-
environment: "${ENVIRONMENT}"
12-
deploy-number: "${NUMBER}"
13-
deploy-url: "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
14-
dedup-id: "${DEDUPLICATION_ID}"
4+
service: "${INPUT_SERVICE}"
5+
description: "${INPUT_DESCRIPTION}"
6+
environment: "${INPUT_ENVIRONMENT}"
7+
deploy-number: "${INPUT_NUMBER}"
8+
deploy-url: "${INPUT_DEPLOY_URL}"
9+
dedup-id: "${INPUT_DEDUPLICATION_ID}"
1510
deployer:
16-
name: "${DEPLOYER_NAME}"
17-
email: "${DEPLOYER_EMAIL}"
11+
name: "${INPUT_DEPLOYER_NAME}"
12+
email: "${INPUT_DEPLOYER_EMAIL}"
1813
EOF
1914

20-
opslevel create deploy -i "$INTEGRATION_URL" -f .
15+
opslevel create deploy -i "$INPUT_INTEGRATION_URL" -f .
2116

2217
rm data.yaml

0 commit comments

Comments
 (0)