How to create your custom GitHub action:
- How to compile your
index.jsfile:- install node
- install ncc globally wih npm:
npm i -g @zeit/ncc
- run
ncc build index.js
| '''Dynamic templates''' | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import locale | |
| from string import Template | |
| class Car: | |
| '''Class Car''' |
| import crypt | |
| def crypt_test(password, salt, checksum='my43charchecksum'): | |
| '''Test only the logic without crypt library''' | |
| correct = 'iCeCream9999' | |
| if password == correct: | |
| return 'prefix {} suffix'.format(checksum) | |
| return 'prefix something else suffix' |
| ''' | |
| This script parses environment variables and gets set of three variables at the time. | |
| It then calls function with those arguments (database, username, password) based on pattern: | |
| DB_<UNIQUENAME>_DATABASE | |
| DB_<UNIQUENAME>_USERNAME | |
| DB_<UNIQUENAME>_PASSWORD | |
| ''' | |
| import re |
| package main | |
| import ( | |
| "encoding/base64" | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| "golang.org/x/crypto/bcrypt" | |
| ) |
| Resources: | |
| MyInstance: | |
| Type: 'AWS::EC2::Instance' | |
| Properties: | |
| AvailabilityZone: eu-west-1a | |
| ImageId: | |
| Ref: ImageId | |
| KeyName: !Ref KeyName | |
| InstanceType: | |
| Ref: InstanceType |
| param( | |
| [string]$version, | |
| $AllowRemoteExecution = $True | |
| ) | |
| # install AV | |
| $path = 'C:\av' | |
| $fileName = 'output.txt' | |
| $fullFilePath = (Join-Path -Path $path -ChildPath $fileName) | |
| New-Item -ItemType Directory -Path $path | |
| New-Item -ItemType File -Path $fullFilePath |
| Get-Disk | Where-Object {$_.PartitionStyle -eq 'RAW'} | Initialize-Disk -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume |
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "containerName": { | |
| "type": "string" | |
| }, | |
| "dnsNameLabel": { | |
| "type": "string" | |
| }, |
| <# | |
| .Synopsis | |
| Gets file content from repository and deploys that as a Gist. | |
| .DESCRIPTION | |
| Used in a GitHub action that automatically deploys your private repository file content as a secret Gist for example. | |
| You must provide GitHub Personal access Token, target Gist ID and Gist filename | |
| .PARAMETER Token | |
| GitHub Personal Access Token with Gist scope | |
| .PARAMETER GistID | |
| GitHub Gist ID |
How to create your custom GitHub action:
index.js file:
npm i -g @zeit/nccncc build index.js