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

Create greetings.yml #244

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 0 additions & 15 deletions .github/workflows/custom-action.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -24,14 +24,16 @@ jobs:
run: echo ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}
- name: Join issue labels
if: github.event_name == 'issues'
run: echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}"
run: echo "Issue labels ${{ join(github.event.issue.labels.*.name, ', ') }}"
- name: Convert job context to JSON
run: echo "Job context in JSON: ${{ toJSON(github.job) }}"
run: 'echo "Job context in JSON: ${{ toJSON(github.job) }}"'
- name: Parse JSON string
run: echo "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}"
run: echo "Parsed JSON ${{ fromJSON('{"hello":"world"}').hello }}"
- name: Hash files
run: echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}
run: echo "Hash of files ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}"
- name: The job has succeeded
if: ${{ success() }}
run: echo "Job ended successfully!"
- name: The job has failed
if: ${{ failure() }}
if: ${{ failure() }}
run: echo "Job failed with an error!"
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,5 @@
name: Multi-event Trigger

on:
push:
branches:
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -2,11 +2,9 @@ name: Windows Workflow Example

on:
push:
branches:
- main
branches: ["main"]
pull_request:
branches:
- main
branches: ["main"]

jobs:
build-and-test:
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
schedule:
- cron: '*/5 * * * *'
- cron: '*/2 * * * *'

jobs:
hello_world:
Original file line number Diff line number Diff line change
@@ -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"
run: echo "Event of type $GITHUB_EVENT_NAME"
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
2 changes: 1 addition & 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.txt
echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json
```

2 changes: 1 addition & 1 deletion github-actions/mydata
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SGVsbG8gTWFycw==
SGVsbG8gZnJvbSBHSCBBY3Rpb25zIQ==