Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main #165

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

main #165

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f999ec8
Create greetings.yml
chaitu092 Dec 2, 2024
82693de
deleted the example yaml files
chaitu092 Dec 2, 2024
36ad1ff
add schedule work flow
chaitu092 Dec 2, 2024
49bd6ce
renamed workflow to scheduled event
chaitu092 Dec 2, 2024
feb6f5d
moved multievents in github workflows
chaitu092 Dec 2, 2024
e80c8ca
updated name in github workflows
chaitu092 Dec 2, 2024
6f94c8e
Merge pull request #1 from chaitu092/dev
chaitu092 Dec 2, 2024
dc48c73
added manual events
chaitu092 Dec 2, 2024
e197e70
webhooks
chaitu092 Dec 4, 2024
19d36b4
renamed workflow
chaitu092 Dec 4, 2024
1b3e66c
added semicolon
chaitu092 Dec 4, 2024
6e63900
formatted
chaitu092 Dec 4, 2024
e3fbe93
conditional
chaitu092 Dec 4, 2024
8dcd2fa
name
chaitu092 Dec 4, 2024
c87743f
condtional modified
chaitu092 Dec 4, 2024
68e54ef
expressions
chaitu092 Dec 4, 2024
e756222
modified
chaitu092 Dec 4, 2024
cb6ee3a
modified changes
chaitu092 Dec 4, 2024
375b1ed
neccesary changes
chaitu092 Dec 4, 2024
f8a9fbc
removed issues
chaitu092 Dec 4, 2024
a513292
modified slash
chaitu092 Dec 4, 2024
4109ab3
runners for macos and windows
chaitu092 Dec 4, 2024
a34e911
commit self hosted runner
chaitu092 Dec 7, 2024
f56d693
workflow commands example
chaitu092 Dec 7, 2024
a4d4b33
printing github env
chaitu092 Dec 7, 2024
87121df
context example
chaitu092 Dec 7, 2024
2834a3d
corrected run command
chaitu092 Dec 7, 2024
7dbf721
reset the step
chaitu092 Dec 7, 2024
2dee1a0
second step
chaitu092 Dec 7, 2024
53560fa
jonbs workflow example
chaitu092 Dec 7, 2024
2b600f7
adjusted syntax
chaitu092 Dec 7, 2024
9001de9
updated env
chaitu092 Dec 7, 2024
9b49643
syntax
chaitu092 Dec 7, 2024
4664cf0
created jobs without depends
chaitu092 Dec 7, 2024
2cc8504
syntax
chaitu092 Dec 7, 2024
1190f15
run syntax
chaitu092 Dec 7, 2024
5b7d40b
spaces
chaitu092 Dec 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/conditional.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: conditional-example-workflow
on: [push]
jobs:
hello-world:
if: github.repository == 'chaitu092/Github-Examples'
runs-on: ubuntu-latest
steps:
- name: "Hello World"
run: echo "Hello World!"
goodbye-moon:
runs-on: ubuntu-latest
steps:
- name: "Goodbye Moon"
run: echo "Goodbye Moon!"
20 changes: 20 additions & 0 deletions .github/workflows/context.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Context examples

on:
push:
branches:
- main

jobs:
my_context:
runs-on: ubuntu-latest
steps:
- name: "My step"
run: echo "Hello! $MY_ACTION"
env:
MY_ACTION: ${{ github.action }}

- name: "My second step"
run: echo "bye! $MY_ACTION"
env:
MY_ACTION: ${{ github.action }}
15 changes: 0 additions & 15 deletions .github/workflows/custom-action.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/expression-functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Expression Functions Demo

on:
push:
branches:
- main

jobs:
expression-functions:
runs-on: ubuntu-latest
steps:
- name: Check if string contains substring
if: contains('Hello world', 'llo')
run: echo "The string contains the substring."
- name: Check if string starts with
if: startsWith('Hello world', 'He')
run: echo "The string starts with 'He'."
- name: Check if string ends with
if: endsWith('Hello world', 'ld')
run: echo "The string ends with 'ld'."
- name: Format and echo string
run: echo ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}
- name: Convert job context to JSON
run: "echo \"Job context in JSON: ${{ toJSON(github.job) }}\""
- name: Parse JSON string
run: "echo \"Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}\""
- name: Hash files
run: "echo \"Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}\""
- name: The job has succeeded
if: ${{ success() }}
run: echo "SUCCESS!"
- name: The job has failed
if: ${{ failure() }}
run: echo "Failure!"
19 changes: 19 additions & 0 deletions .github/workflows/jobs-withoutdepends.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Jobs without depends

on:
push:
branches:
- main

jobs:
job2:
runs-on: ubuntu-latest
steps:
- name: stepA
run: echo "Chaitu"

job1:
runs-on: ubuntu-latest
steps:
- name: stepB
run: echo "Hi"
19 changes: 19 additions & 0 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Jobsssss

on:
push:
branches:
- main

jobs:
job2:
runs-on: ubuntu-latest
needs: job1
steps:
- name: stepA
run: echo "Saiii"
job1:
runs-on: ubuntu-latest
steps:
- name: stepB
run: echo "Hello"
32 changes: 32 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Manual Trigger with Params

on:
workflow_dispatch:
inputs:
name:
description: 'Name of the person to greet'
required: true
type: string
greeting:
description: 'Type of greeting'
required: true
type: string
data:
description: 'Base64 encoded content of a file'
required: false
type: string

jobs:
greet:
runs-on: ubuntu-latest
steps:
- name: Decode File Content
run: |
echo "${{ inputs.data }}" | base64 --decode > ./decoded_file.txt
- name: Display Greeting
run: |
echo "${{ inputs.greeting }}, ${{ inputs.name }}!"
- name: Display File Content
run: |
echo "Contents of the file:"
cat ./decoded_file.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: multi-event
on:
push:
branches:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/runner-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: macOS Workflow Example

on:
push:
branches:
- main

jobs:
build-and-test:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create Swift File
run: |
echo 'print("Hello from Swift on macOS")' > hello.swift

- name: Install dependencies
run: |
brew install swiftlint

- name: Run SwiftLint
run: swiftlint

- name: Compile and run Swift program
run: |
swiftc hello.swift
./hello
17 changes: 17 additions & 0 deletions .github/workflows/runner-self-hosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# If you don't create a self-hosted runner you will see:
# Waiting for a runner to pick up this job...
name: Self-hosted Runner Workflow

on:
push:
branches:
- main

jobs:
example-job:
runs-on: self-hosted
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Run a one-line script
run: echo "Hello from a self-hosted runner!"
38 changes: 38 additions & 0 deletions .github/workflows/runner-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Windows Workflow Example

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies
run: choco install dotnetcore-sdk
shell: powershell

- name: Compile and run C# program
run: |
Add-Content -Path "Hello.cs" -Value @"
using System;
public class Hello
{
public static void Main()
{
Console.WriteLine("Hello, Windows from C#");
}
}
"@
dotnet new console --force --no-restore
Move-Item -Path "Hello.cs" -Destination "Program.cs" -Force
dotnet run
shell: powershell
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: scheduled events
on:
schedule:
- cron: '*/5 * * * *'
- cron: '*/1 * * * *'

jobs:
hello_world:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Webhook Event example

on:
repository_dispatch:
types:
- webhook

jobs:
respond-to-dispatch:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: "Run a script"
run: 'echo "Event of type: $GITHUB_EVENT_NAME"'
26 changes: 26 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Worflow Commands

on:
push:
branches:
- main
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: "group logging"
run: |
echo "::group:: My Group Message"
echo "Msg 1"
echo "Msg 2"
echo "::endgroup::"

- name: "step 1"
run: |
echo "MY_VAL = hello" >> $GITHUB_ENV

- name: "step 2"
run: |
echo $MY_VAL