From a5ba3a7c3d84330b681be3ad2225921733c29520 Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:19:07 +0530 Subject: [PATCH 01/14] Create greetings.yml --- .github/workflows/greetings.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/greetings.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 000000000..46774343e --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,16 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Message that will be displayed on users' first issue" + pr-message: "Message that will be displayed on users' first pull request" From 7a73d4775872cc8c73ccb8475eb48bb77598e80f Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:38:40 +0530 Subject: [PATCH 02/14] Update greetings.yml --- .github/workflows/greetings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 46774343e..086fdc5c1 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -1,6 +1,6 @@ name: Greetings -on: [pull_request_target, issues] +on: [pull_request_target, issues, push] jobs: greeting: From 995631116754061324d5e12b8a099dbc0dabbd1f Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 10:58:52 +0530 Subject: [PATCH 03/14] move these to save them later --- .github/workflows/greetings.yml | 16 ---------------- .../templates}/custom-action.yml | 0 github-actions/templates/greetings.yml | 3 +-- 3 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 .github/workflows/greetings.yml rename {.github/workflows => github-actions/templates}/custom-action.yml (100%) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index 086fdc5c1..000000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Greetings - -on: [pull_request_target, issues, push] - -jobs: - greeting: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Message that will be displayed on users' first issue" - pr-message: "Message that will be displayed on users' first pull request" diff --git a/.github/workflows/custom-action.yml b/github-actions/templates/custom-action.yml similarity index 100% rename from .github/workflows/custom-action.yml rename to github-actions/templates/custom-action.yml diff --git a/github-actions/templates/greetings.yml b/github-actions/templates/greetings.yml index 996da6bbd..086fdc5c1 100644 --- a/github-actions/templates/greetings.yml +++ b/github-actions/templates/greetings.yml @@ -1,6 +1,6 @@ name: Greetings -on: [pull_request_target, issues] +on: [pull_request_target, issues, push] jobs: greeting: @@ -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 }} From 5f729f344775181fd205e658b6d0ecfb7d0f68be Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:31:44 +0530 Subject: [PATCH 04/14] add schedule events --- .github/workflows/schedule.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/schedule.yml diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml new file mode 100644 index 000000000..9ae566778 --- /dev/null +++ b/.github/workflows/schedule.yml @@ -0,0 +1,10 @@ +on: + schedule: + - cron: '*/2 * * * *' + +jobs: + hello_world: + runs-on: ubuntu-latest + steps: + - name: Echo current time + run: echo "The current server time is $(date)" From 59c771f10ec8b1202ceebe4bd53a6b6a0ed20d36 Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:45:41 +0530 Subject: [PATCH 05/14] multi events templates --- .github/workflows/multi-event.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/multi-event.yml diff --git a/.github/workflows/multi-event.yml b/.github/workflows/multi-event.yml new file mode 100644 index 000000000..a3275be38 --- /dev/null +++ b/.github/workflows/multi-event.yml @@ -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" \ No newline at end of file From 0b476a038c34d8ce8e5c8d56dde6c33322252f51 Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:48:33 +0530 Subject: [PATCH 06/14] trigger workflow on dev --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 43fc9143d..907b2e127 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Github-Examples A repo containing GitHub for programmatic examples + \ No newline at end of file From 96755b17a3de475f2cc74372314e9a883573d917 Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:59:07 +0530 Subject: [PATCH 07/14] trigger events on push to dev --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 907b2e127..fc0302c36 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Github-Examples A repo containing GitHub for programmatic examples - \ No newline at end of file + \ No newline at end of file From afe72bbbb7cb713855e9ebffe5368a81909658a9 Mon Sep 17 00:00:00 2001 From: sheane mario <129259493+Sheane-mario@users.noreply.github.com> Date: Mon, 11 Aug 2025 12:03:34 +0530 Subject: [PATCH 08/14] scheduled workflows --- .github/workflows/schedule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml index 9ae566778..4186413d9 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -1,6 +1,6 @@ on: schedule: - - cron: '*/2 * * * *' + - cron: '*/1 * * * *' jobs: hello_world: From 31e194d649df6ca421f60a7912f6b1beabd7862d Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 15:14:22 +0530 Subject: [PATCH 09/14] manual workflows --- .github/workflows/manual.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/manual.yml diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 000000000..081adf3a6 --- /dev/null +++ b/.github/workflows/manual.yml @@ -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 \ No newline at end of file From a1f944be38dbfc83c2be206448395e90335203c5 Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 21:30:45 +0530 Subject: [PATCH 10/14] webhook workflow --- .github/workflows/webhook.yml | 15 +++++++++++++++ github-actions/Readme.me | 2 +- github-actions/templates/webhook.yml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/webhook.yml diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml new file mode 100644 index 000000000..b200d991f --- /dev/null +++ b/.github/workflows/webhook.yml @@ -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" diff --git a/github-actions/Readme.me b/github-actions/Readme.me index 9be613aad..f07775bac 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -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 ``` diff --git a/github-actions/templates/webhook.yml b/github-actions/templates/webhook.yml index dbdf1e47d..b200d991f 100644 --- a/github-actions/templates/webhook.yml +++ b/github-actions/templates/webhook.yml @@ -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" From 01f383d5273db84171615a4aefda52443e81d008 Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 22:32:53 +0530 Subject: [PATCH 11/14] webhook --- .github/workflows/webhook.yml | 2 -- github-actions/Readme.me | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index b200d991f..08489e118 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -9,7 +9,5 @@ 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" diff --git a/github-actions/Readme.me b/github-actions/Readme.me index f07775bac..cc9483852 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -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 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" \ +-d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \ +https://api.github.com/repos/Sheane-mario/Github-Examples/dispatches ``` \ No newline at end of file From e2759fb8a91a197736d2ba086d53d0723fda1a32 Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 22:41:10 +0530 Subject: [PATCH 12/14] webhook --- .github/workflows/webhook.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index 08489e118..e61ba0aea 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -9,5 +9,5 @@ jobs: respond-to-dispatch: runs-on: ubuntu-latest steps: - - name: Run a script - run: echo "Event of type: $GITHUB_EVENT_NAME" + - name: "Run a script" + run: 'echo "Event of type: $GITHUB_EVENT_NAME"' From baf1116e2e8e361e3263f9372143df8e41261250 Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 22:41:55 +0530 Subject: [PATCH 13/14] readme --- github-actions/Readme.me | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/Readme.me b/github-actions/Readme.me index cc9483852..6eee2a3d6 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -18,7 +18,7 @@ https://api.github.com/repos/{owner}/{repo}/dispatches ```sh curl -X POST \ -H "Accept: application/vnd.github+json" \ --H "Authorization: token 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" \ +-H "Authorization: token {PAT}" \ -d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \ https://api.github.com/repos/Sheane-mario/Github-Examples/dispatches ``` \ No newline at end of file From 0d4ce68111c322b1ae7eebe33e92a66fcca3c089 Mon Sep 17 00:00:00 2001 From: sheanemario Date: Mon, 11 Aug 2025 22:43:39 +0530 Subject: [PATCH 14/14] readme --- github-actions/Readme.me | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/Readme.me b/github-actions/Readme.me index 6eee2a3d6..0e65f6767 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -18,7 +18,7 @@ https://api.github.com/repos/{owner}/{repo}/dispatches ```sh curl -X POST \ -H "Accept: application/vnd.github+json" \ --H "Authorization: token {PAT}" \ +-H "Authorization: token {PAT} " \ -d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \ https://api.github.com/repos/Sheane-mario/Github-Examples/dispatches ``` \ No newline at end of file