Skip to content

Commit de90190

Browse files
authored
Update promote-command.yml
1 parent 32bac2d commit de90190

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

.github/workflows/promote-command.yml

+24-19
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414

1515
- name: Set variabler for image og cluster
1616
run: |
17-
echo "::set-env name=TAG::$(echo ${{ github.event.client_payload.slash_command.arg1 }} | cut -c16-22)"
18-
echo "::set-env name=IMAGE::$IMAGE_BASE:${{ github.event.client_payload.slash_command.arg1 }}"
19-
echo "::set-env name=CLUSTER::${{ github.event.client_payload.slash_command.arg2 }}"
20-
17+
echo "::set-env name=TAG::$(echo ${{ github.event.client_payload.github.payload.issue.title }} | awk '{print $NF}' | awk -F- '{print $NF}')"
18+
echo "::set-env name=IMAGE::$IMAGE_BASE:$(echo ${{ github.event.client_payload.github.payload.issue.title }} | awk '{print $NF}')"
19+
echo "::set-env name=CLUSTER::${{ github.event.client_payload.slash_command.arg1 }}"
20+
2121
- name: Sjekk ut kode
2222
uses: actions/checkout@v1
2323
with:
@@ -34,23 +34,28 @@ jobs:
3434

3535
- name: Oppdater kommentar med deployment status ved feil
3636
if: failure()
37-
uses: peter-evans/create-or-update-comment@v1
37+
uses: actions/[email protected]
3838
with:
39-
token: ${{ secrets.NOTIFICATION }}
40-
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
41-
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
42-
body: |
43-
>promote ${{ github.event.client_payload.slash_command.args }} feilet
44-
reaction-type: -1
45-
39+
github-token: ${{secrets.NOTIFICATION}}
40+
script: |
41+
const issue = { owner: context.issue.owner,
42+
repo: context.issue.repo,
43+
issue_number: ${{ github.event.client_payload.github.payload.issue.number }} }
44+
github.issues.createComment({...issue,
45+
title: 'Deploy av ${{ env.TAG }}',
46+
body: '>promote ${{ github.event.client_payload.slash_command.args }} feilet'})
47+
github.issues.addLabels({...issue, labels: ['deployment-failed','${{ env.CLUSTER }}'])
48+
4649
- name: Oppdater kommentar med deployment status
4750
if: success()
48-
uses: peter-evans/create-or-update-comment@v1
51+
uses: actions/[email protected]
4952
with:
50-
token: ${{ secrets.NOTIFICATION }}
51-
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
52-
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
53-
body: |
54-
>promote ${{ github.event.client_payload.slash_command.args }} var OK
55-
reaction-type: rocket
53+
github-token: ${{secrets.GITHUB_TOKEN}}
54+
script: |
55+
const issue = { owner: context.issue.owner,
56+
repo: context.issue.repo,
57+
issue_number: ${{ github.event.client_payload.github.payload.issue.number }} }
58+
const new_comment = github.issues.createComment({...issue,
59+
body: '>promote ${{ github.event.client_payload.slash_command.args }} var OK'})
60+
github.issues.addLabels({...issue, labels: ['${{ env.CLUSTER }}']})
5661

0 commit comments

Comments
 (0)