• Stars
    star
    291
  • Rank 141,715 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 5 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Various proofs of concept examples using Github Actions πŸ€–

poc-github-actions

title

This repository contains various proofs of concept using a Github Actions through workflows πŸ€–

Contents πŸ‡§πŸ‡·

Workflow YAML Basic Structure Explanation

name: Github action workflow name

on:
  push: # Run this workflow every time a new commit pushed to the repository
  pull_request:  # Run this workflow every time a new pull request is opened to the repository
  scheduled: # Run this workflow as a cron job
    - cron: "0 0 * * MON-FRI"
  workflow_dispatch: # Run this workflow on demand (manually)

jobs: # All workflows need at list one job

  job-key: #First job
    name: Job Name
    runs-on: ubuntu-latest # Set the type of machine the workflow will run on
    steps: # Each job can be divided in many steps

      - name: Checkout code # Step name
        uses: actions/checkout@v2 # Action used on the step

      - name: Run Super-Linter # Another step name
        uses: github/super-linter@v3  # Action used on the step
        env:  # Environment variables used on the step
          DEFAULT_BRANCH: main
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Run specific commands # Another step name
        run: |
          ls -lha
          echo "This is a shell command"

Examples

01 - Default Workflow

This workflow uses CRON to run some basic commands.

02 - Secret Workflow

This workflow uses CRON to run some basic commands using repository secrets.

03 - Python Script Workflow

This workflow uses CRON to execute a specific script run.py located on the repository.

04 - Remote Dispatch Action Initiator

This workflow uses CRON to dispatch an event to the ritchie-formulas-scheduler-demo repository.

05 - Container Workflow

This workflow uses CRON with a docker container where Ritchie CLI and Golang are installed, then check Ritchie CLI and Golang versions through commands.

06 - Docker Image Workflow

This workflow uses CRON and a docker image foundeo/minibox:latest. It also specify an entrypoint (the command to run inside the container) and args (command line arguments to pass to the command specified in entrypoint). It is possible to omit the entrypoint if the container already species the entrypoint you want to use.

07 - Action workflow

This workflow will run an Action each time a PUSH event occurs on the repository. This specific action runs a Ritchie CLI formula.

08 - Outputs workflow

This workflow illustrates how to set outputs in a job to use them on another job. This specific workflow prints Hello-World.

09 - Artifacts workflow

This workflow illustrates how to pass data between jobs in the same workflow. For more information, see the actions/upload-artifact and download-artifact actions. The full math operation performed in this workflow example is (3 + 7) x 9 = 90.

10 - Environment workflow

This workflow illustrates how to use environment variables from the whole workflow, a specific job, or a specific step, as well as for an environment secret.

11 - Input workflow

This workflow illustrates how to use input variables on a workflow_dispatch event.

12 - Run Workflow

This workflow illustrates how to run a workflow once another specific one has been completed (with success or failure).

13 - Create Pull Request

This workflow uses CRON to automatically create a Pull Request committing updated files.

14 - Auto Merge

This workflow illustrates how to automatically merge a Pull Request with a specific label automerge.

15 - Push Dev

This workflow only run when a push is made to the dev branch. Note that with this implementation, the workflow needs to be present on the specific branch as well (here dev).

16 - Conditional

This workflow illustrates how to use conditional through the if variable.

17 - Issue Greeter

This workflow illustrates how to write an automatic comment on a new issue, without using action, through the github API.

18 - Specific File

This workflow illustrates how to trigger a workflow when specific files are updated by a push or pull_request event.

19 - Push Event

This workflow illustrates how use the checkout action to create a push event, updating a file and committing it to the branch.

20 - Generate Patch Tag with Cherry Pick

This workflow illustrates how use cherry-pick to generate a new repository tag informing 3 inputs (reference tag, new tag, and commit hash).

21 - Generate Release Branch with Cherry Pick

This workflow illustrates how use cherry-pick to generate a new release branch informing 3 inputs (reference tag, new tag, and commit hash).

22 - Install runner tools

This workflow illustrates how to install tools not supported by the ubuntu runner using apt-get install.

23 - Upload reset Asset

This workflow illustrates how to upload a release asset. Example

24 - Github Context

This workflow illustrates how to access various context variables on a workflow.

25 - Artifacts between Workflows 1 25 - Artifacts between Workflows 2

These workflows illustrate how to share datas between various workflows using artifacts.

26 - Create branch on another repo

This workflow illustrates how to create a new branch on another repository based on the current repository tag.

27 - Check Tags

This workflow illustrates how to use outputs between jobs with the needs context to check tags and manage them to perfom some operation according to their name.

28 - Create Pull Request (Workflow)

This workflow illustrates how to create a new Pull Request based on a branch name after a push event.

29 - Check Actor on PR or PUSH

This workflow illustrates how to add a comment on a new Pull Request based on the github actor name after a PR event.

30 - Webhook Release

This workflow illustrates how to call a webhook on each release extracting the release tag.

31 - Untouchable file

This workflow illustrates how to close a Pull Request automatically if it updates on file that shouldn't be modified.

32 - PR approved and labeled

This workflow illustrates how to perform a specific action when approving a Pull request if it contains a specific label.

33 - Reusable workflow

This workflow illustrates how to implement a reusable workflow.

34 - Workflow Call

This workflow illustrates how to use and call a reusable workflow (cf workflow 33 above).

35 - Github Config

This workflow illustrates how to extract and use the user email and username from the commit using github config log commands.

36 - Local Action

This workflow illustrates how to use a local action file in one (or multiple workflows) and extract its outputs to perform other operations.

37 - Continue On Error Matrix

This workflow illustrates how to use matrix as well as expressions with continue-on-error and if conditionnal fields.

38 - Get PR number from PUSH event

This workflow illustrates how to get the related PR number to a push event.

PR event and Related PUSH event

39 - Extract From Branch 40 - Invoked Workflow Dispatch

This workflows illustrate how to extract the tag version when a specific branch is created (e.g: release-1.2.3), and how to invoke another workflow through a disptach event sending this tag as input.

41 - Commit other repo

This workflow illustrates how to commit files from the current repo to another repo.

43 - Not trigger on tag

This workflow illustrates how to trigger a workflow on different event but NOT on tag.

44 - Check if PR from Fork

This workflow illustrates how to check if a PR is opened from a FORK repository or not.

45 - Get all yaml files

This workflow illustrates how to list all files from a specific extension (here, .yaml or .yml).

46 - Print env

This workflow illustrates how to list all env variables set in the runner.

47 - Force Failure

This workflow illustrates how to force a workflow failure if a condition isn't met.

48 - Wait for reusable completion

This workflow illustrates how to wait for other workflows completion before executing some operation (using reusable workflows).

49 - Rename on release

This workflow illustrates how to rename a file according to the github ref name (branch or tag name).

50 - Create tag

This workflow illustrates how to simply create a tag in a job.

51 - Concurrency

This workflow illustrates how to use concurrency to avoid the same workflow to run in parallel for different push to the same branch (for example to limit Github actions runner usage in private repo).

52 - Print Secret

This workflow illustrates how to print secrets values on a workflow run. To harden the security of your github actions, have a look at this guide on the Github Official Documentation.

53 - Concatenation

This workflow illustrates how to concatenate env variables using the environment file.

54 - Permissiom

This workflow illustrates how to use the permission field at the workflow level. Giving the GITHUB_TOKEN a specific permission scope during the workflow execution.

55 - Create Issue 55 - Read Issue

These workflows illustrate how to create and read an issue body variable according to a specific issue template.

57 - Reusable outputs

This workflow illustrates how to use outputs with reusable workflows.

58 - Env Expressions

This workflows illustrates how to use expressions when setting env variables ath the workflow level, according to the trigger event.

59 - Step Context

This workflows illustrates how to use step context, which contains detail about the execution of each step by default. Using the outcome property of each step we can check the result of its execution.

60 - Save secrets variables

This workflow illustrates how to save secrets in artifacts to use on later jobs.

61 - Create Tag and Release 62 - Create Trigger on release other workflow

Those workflows illustrate how to trigger a release creation (with tag based on a branch syntax) where the release publication could trigger a deployment pipeline.

63 - Matrix folder

This workflow illustrates how to identify updated folders to perfom a similar behavior based on the folder through a reusable workflow with a matrix strategy.

65 - Sequential Matrix

This workflow illustrates how to execute sequencial jobs in specific order using matrix with max-parallel: 1 strategy.

66 - Matrix Object

This workflow illustrates how to manipulate matrix object to perform different operation according to a object type.

67 - From JSON Env Var

This workflow illustrates how to extract a specific item from a JSON list stored in a environment variable dynamically.

68 - OS Types

This workflow shows the os type value for each github runner os.

More Repositories

1

useful-actions

Curated list of useful Github actions with workflows examples πŸ’‘
Dockerfile
252
star
2

java-training-api

Esse repositΓ³rio disponibiliza uma versΓ£o zero de uma API de cadastro de usuΓ‘rios (Users) a ser melhorada com desafios β˜•οΈ πŸ‡§πŸ‡·
Java
102
star
3

developers-tips-and-tricks-resources

Repository with various tips and tricks for developers πŸ§‘β€πŸ’»πŸ’‘
66
star
4

clone-github-repo-action

Github Action to clone a public or private Github repository and access its content on others repositories' workflows ♻️
46
star
5

GuillaumeFalourd

🟩⬜️ Fork this repository to customize your profile! πŸ§‘β€πŸ’»β­
44
star
6

formulas-github

Ritchie CLI formulas interacting with Github APIs :octocat:
Python
35
star
7

java-exercices

ExercΓ­cios em Java para iniciantes (prΓ©-Junior) β˜•οΈπŸ‡§πŸ‡·
Java
34
star
8

setup-windows10-sdk-action

Github action to download and install a specific version of the Windows 10 SDK πŸ“¦
JavaScript
26
star
9

assert-command-line-output

Github Action to assert / check a command line output πŸ•΅οΈβš™οΈπŸ–₯
19
star
10

formulas-python

Ritchie CLI formulas in Python 🐍
Python
18
star
11

java-trilha-basica

Trilha de introdução ao uso de Java no Back-End πŸ“šβ˜•οΈπŸ‡§πŸ‡·
13
star
12

git-commit-push

GitHub Action to commit & push changes made in workflows :octocat:
13
star
13

formulas-aws

Ritchie CLI formulas to create a Kubernetes Cluster on AWS through one command line πŸ€– πŸ› 
Go
12
star
14

create-other-repo-branch-action

Github Action to create a new branch on another repository πŸ†•πŸš€
11
star
15

setup-rsync

Github Actions to setup rsync (all os supported) πŸ”„
10
star
16

formulas-games

Ritchie CLI formulas with games πŸ‘Ύ
Python
10
star
17

docker-mysql-python

POC usando Docker com MySQL e Python (FastAPI) πŸ‡§πŸ‡·
Python
9
star
18

poc-encryption-jwt

POC using pyjwt to encrypt / decrypt JWT 🐍 πŸ”
Python
8
star
19

formulas-insights

Ritchie CLI formulas to get insights from various tools such as Github, GoogleDocs, LinkedIn or other social networks πŸ•΅οΈβ€β™‚οΈ
Python
8
star
20

stackspot-ai-rqc

StackSpot AI Remote Quick Command Action
Python
7
star
21

sign-and-notarize-gha

Repository explaining step by step how to sign and notarize packages with Apple using Github Actions 🍎 :octocat:
7
star
22

repositories-reports

You can fork this project to get weekly insights reports for your personal repositories ⏱ πŸ“‹ :octocat:
5
star
23

ritchie-formulas-scheduler-demo

Repository with a Github Action workflow example to execute specific Ritchie CLI formulas using CRON ⏰
5
star
24

poc-bank-api-java

POC of a bank api in JAVA β˜•οΈ
Java
4
star
25

aws-clis-action

Github Action to use ANY version (1.x.y or 2.x.y) of AWS CLI to run ANY AWS CLI commands on your workflows πŸ€–
Shell
4
star
26

stackspot-ai-security-action-poc

StackSpot AI Security Action POC
Python
3
star
27

pull-request-action

Github Actions to create pull request (all os supported) using Github CLI ‡️
3
star
28

formulas-gRPC

Ritchie CLI formulas interacting with API using gRPC
Java
3
star
29

wait-sleep-action

Github actions to wait / sleep during a workflow execution ⏱
3
star
30

write-java-properties-file

GitHub Action to write keys=values to a java properties file β˜•οΈ :octocat:
Shell
3
star
31

formulas-4-tests

This repository contains Ritchie CLI formulas I'm testing πŸ’£
Makefile
2
star
32

poc-grpc-java-gradle

POC of a gRPC project in Java using Gradle β˜•οΈ
Java
2
star
33

notary-tools

Github Action to notarize and staple Apple products :octocat:
2
star
34

diff-action

Github Action to compare 2 files using diff πŸ•΅οΈ
2
star
35

ritchie-demo-create-cluster

Terraform project created with Ritchie CLI to provide a Kubernetes Cluster.
HCL
2
star
36

open-issue-action

Github Action to open a new issue on ANY Github repository that the Personal Access Token (PAT) has access to πŸ€–
Dockerfile
2
star
37

copy-push-files

GitHub Action to copy & push contents (files / directory) from a repository to another :octocat:
2
star
38

ritchie-cli-action

Github Action to run Ritchie CLI commands on any OS runner βš™οΈπŸ–₯
2
star
39

convert-json-to-env

Github Actions to convert variables from a JSON file to workflow ENV variables :octocat:
Python
1
star
40

formulas-pontomais

Ritchie CLI formulas interacting with Pontomais API πŸ€– πŸ› 
Go
1
star
41

SSH-to-HTTPS

Github Action to configure git to use HTTPS authentication instead of SSH
1
star
42

poc-chalice-python

POC of a Cloud Hosted API Server using Chalice and AWS Lambda in Python 🐍
Python
1
star
43

formulas-v3

Formulas to test Ritchie CLI v3 features and OS CLI core commands.
Python
1
star
44

command-output-file-action

Github Action to generate an output file from a command execution (success or error) πŸ“
1
star
45

poc-grpc-java-maven

POC of a gRPC project in Java using Maven β˜•οΈ
Java
1
star
46

stackspot-plugins

Repository with StackSpot plugins
HCL
1
star
47

poc-subprocess

POC using subprocess lib in Python 🐍
Python
1
star
48

poc-cli-golang

POC of a CLI project using Golang 🐿 with Cobra.
Go
1
star
49

poc-proto

This repository contains diversous protobuf files to use with gRPC services implementations.
1
star
50

ritchie-docker-images

Docker images to run ritchie cli formulas
Dockerfile
1
star
51

formulas-office-hours

Ritchie CLI formulas from the 10/03/2021 Zup Office Hours 🏒 ⏱
Makefile
1
star
52

poc-cli-translations

POC using Click and python-i18n to test how to implement translations on a CLI tool.
Python
1
star
53

ritchie-tdc-poa

Terraform project created with Ritchie CLI to provide a Kubernetes Cluster. The demonstration happened during The Developer Conference Porto Alegre on 12.04.2020
1
star
54

stackspot-actions

Repository with StackSpot actions
Python
1
star
55

ritchie-action-java-8

Ritchie CLI github action for JAVA 8 πŸ€–
Shell
1
star
56

branch-exists

GitHub Action to check if a branch exists in the current repo :octocat:
1
star
57

ritchie-action-python

Ritchie CLI github action for PYTHON πŸ€–
Shell
1
star
58

ritchie-tdc-recife

Terraform project created with Ritchie CLI to provide a Kubernetes Cluster. The demonstration happened during The Developer Conference Recife on 10.28.2020
1
star
59

github-team-members

Github Actions to get / check Github Team Members :octocat:
1
star