adding dope code (#1333)

* adding dope code

* fix contains logic
This commit is contained in:
Lukas Gravley 2021-03-10 08:36:46 -06:00 committed by GitHub
parent b39cbbdf82
commit 5109e57ff4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 125 additions and 2 deletions

View file

@ -70,6 +70,36 @@ jobs:
username: ${{ secrets.GCR_USERNAME }}
password: ${{ secrets.GCR_TOKEN }}
#########################
# Update deployment API #
#########################
- name: Start deployment
uses: bobheadxi/deployments@v0.4.3
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Production
#######################################################
# Create a GitHub Issue with the info from this build #
#######################################################
- name: Create GitHub Issue
uses: actions/github-script@v3.1.0
id: create-issue
with:
# https://octokit.github.io/rest.js/v18#issues-create
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const create = await github.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Deploying to production",
body: 'Currently deploying...'
})
console.log('create', create)
return create.data.number
###########################################
# Build and Push containers to registries #
###########################################
@ -88,3 +118,95 @@ jobs:
github/super-linter:v3
ghcr.io/github/super-linter:latest
ghcr.io/github/super-linter:v3
########################################
# Update the issue with success status #
########################################
- name: Update issue success
uses: actions/github-script@v3.1.0
if: success()
with:
# https://octokit.github.io/rest.js/v18#issues-create
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: "${{ steps.create-issue.outputs.result }}",
title: "New issue created",
body: "Successfuly deployed to production"
})
############################
# Close issue from success #
############################
- name: Close issue success
uses: actions/github-script@v3.1.0
if: success()
with:
# https://octokit.github.io/rest.js/v18#issues-create
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: "${{ steps.create-issue.outputs.result }}",
state: "closed"
})
########################################
# Update the issue with failure status #
########################################
- name: Update issue failure
uses: actions/github-script@v3.1.0
if: failure()
with:
# https://octokit.github.io/rest.js/v18#issues-create
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: "${{ steps.create-issue.outputs.result }}",
title: "New issue created",
body: "Failed to deploy to production"
})
############################
# Assign admins on failure #
############################
- name: Assign Admins on failure
uses: actions/github-script@v3.1.0
if: failure()
with:
# https://octokit.github.io/rest.js/v18#issues-create
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: "${{ steps.create-issue.outputs.result }}",
assignees: [
'admiralawkbar',
'jwiebalk',
'IAmHughes',
'nemchik',
'Hanse00',
'GaboFDC',
'ferrarimarco'
]
})
#########################
# Update Deployment API #
#########################
- name: Update deployment status
uses: bobheadxi/deployments@v0.4.3
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: https://github.com/github/super-linter

View file

@ -32,7 +32,8 @@ jobs:
# Delete the created issue as it was created by someone #
# who is not authorized to create a release #
#########################################################
if: contains(github.event.issue.title, 'Super-Linter Release:') &&
if: contains(github.event.issue.title, 'Super-Linter') &&
contains(github.event.issue.title, 'Release:') &&
github.actor != 'admiralawkbar' || github.actor != 'jwiebalk' ||
github.actor != 'IAmHughes' || github.actor != 'nemchik' ||
github.actor != 'Hanse00' || github.actor != 'github-actions' ||
@ -252,4 +253,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: https://github.com/orgs/${{github.repository_owner}}/container/package/${{github.repository.name}}
env_url: https://github.com/github/super-linter/releases/tag/${{ env.RELEASE_VERSION }}