Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
19 changes: 19 additions & 0 deletions .github/workflows/multi-event.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main

jobs:
hello_world:
runs-on: ubuntu-latest
steps:
- name: "Echo Basic Information"
run: |
echo "REF: $GITHUB_REF"
echo "Job ID: $GITHUB_JOB"
echo "Action: $GITHUB_ACTION"
echo "Actor: $GITHUB_ACTOR"
10 changes: 10 additions & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
schedule:
- cron: '*/1 * * * *'

jobs:
hello_world:
runs-on: ubuntu-latest
steps:
- name: Echo current time
run: echo "The current server time is $(date)"
13 changes: 13 additions & 0 deletions .github/workflows/webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Webhook Event example"

on:
repository_dispatch:
types:
- webhook

jobs:
respond-to-dispatch:
runs-on: ubuntu-latest
steps:
- name: "Run a script"
run: 'echo "Event of type: $GITHUB_EVENT_NAME"'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Github-Examples
A repo containing GitHub for programmatic examples

10 changes: 9 additions & 1 deletion github-actions/Readme.me
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Manual Trigger

```sh
gh workflow run greet.yml -f name=mona -f greeting=hello -F data=@myfile.txt
gh workflow run manual.yml -f name=mona -f greeting=hello -F data=@mydata
echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json
```

Expand All @@ -13,4 +13,12 @@ curl -X POST \
-H "Authorization: token {PAT} \
-d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \
https://api.github.com/repos/{owner}/{repo}/dispatches
```

```sh
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token {PAT} " \
-d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \
https://api.github.com/repos/Sheane-mario/Github-Examples/dispatches
```
3 changes: 1 addition & 2 deletions github-actions/templates/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Greetings

on: [pull_request_target, issues]
on: [pull_request_target, issues, push]

jobs:
greeting:
Expand All @@ -9,7 +9,6 @@ jobs:
issues: write
pull-requests: write
steps:
# https://github.com/actions/first-interaction
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion github-actions/templates/webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
respond-to-dispatch:
runs-on: ubuntu-latest
steps:
- name Checkout repo
- name: Checkout repo
uses: actions/checkout@v2
- name: Run a script
run: echo "Event of type: $GITHUB_EVENT_NAME"