From f68eddc238a64e9f87c056c2dd9a68841a74befb Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Tue, 7 Oct 2025 13:39:08 +0100 Subject: [PATCH 01/13] Create greetings.yml A practice DevOps project --- .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 e4c986ef56e06b2d7cbe07f471fbf411788345d3 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:12:01 +0100 Subject: [PATCH 02/13] Cron --- .github/workflows/greetings.yml | 16 ---------------- .github/workflows/schedule.yml | 10 ++++++++++ 2 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/greetings.yml create mode 100644 .github/workflows/schedule.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index 46774343e..000000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,16 +0,0 @@ -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" 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 c8f1abacb31a5cf54262ddb4f04d84aeaf412f47 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:25:56 +0100 Subject: [PATCH 03/13] Schedule workflow --- .github/workflows/custom-action.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/custom-action.yml diff --git a/.github/workflows/custom-action.yml b/.github/workflows/custom-action.yml deleted file mode 100644 index 7a87b53f1..000000000 --- a/.github/workflows/custom-action.yml +++ /dev/null @@ -1,15 +0,0 @@ -on: [push] - -jobs: - my-job: - runs-on: ubuntu-latest - name: A job to say hello - steps: - - name: Hello world action step - id: hello - uses: omenking/barsoom@0.0.6 - with: - name: 'Brown' - # Use the output from the `hello` step - - name: Get the Output - run: echo "The time was ${{ steps.hello.outputs.greeting }}" \ No newline at end of file From b4f9d438832fbaee1f60067a7c9b5d1e4e67225f Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:28:39 +0100 Subject: [PATCH 04/13] Schedule workflow --- .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 a368c1bd6efaaff8cd005f27c789851ff330fa92 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:39:39 +0100 Subject: [PATCH 05/13] multi-event template --- .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 66e9153af6ce22dc2319edae8b70c5e2508bbe5f Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:16:16 +0100 Subject: [PATCH 06/13] multi event template --- 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 dce24c0b744c249d37d4835efa0d3a915565892d Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:17:23 +0100 Subject: [PATCH 07/13] multi event template --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 907b2e127..81ca653f1 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 359ee5a1bb40ea8414df27d42caf9acd10fc5b84 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:50:08 +0000 Subject: [PATCH 08/13] manual workflow --- .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 91e200084e5f7845fb801e5ab13f6cae6894d80a Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sun, 16 Nov 2025 12:24:17 +0000 Subject: [PATCH 09/13] webhook not trigger --- .github/workflows/manual.yml | 32 ------------------------------- .github/workflows/multi-event.yml | 19 ------------------ .github/workflows/schedule.yml | 10 ---------- .github/workflows/webhook.yml | 15 +++++++++++++++ 4 files changed, 15 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/manual.yml delete mode 100644 .github/workflows/multi-event.yml delete mode 100644 .github/workflows/schedule.yml create mode 100644 .github/workflows/webhook.yml diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml deleted file mode 100644 index 081adf3a6..000000000 --- a/.github/workflows/manual.yml +++ /dev/null @@ -1,32 +0,0 @@ -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 diff --git a/.github/workflows/multi-event.yml b/.github/workflows/multi-event.yml deleted file mode 100644 index a3275be38..000000000 --- a/.github/workflows/multi-event.yml +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml deleted file mode 100644 index 4186413d9..000000000 --- a/.github/workflows/schedule.yml +++ /dev/null @@ -1,10 +0,0 @@ -on: - schedule: - - cron: '*/1 * * * *' - -jobs: - hello_world: - runs-on: ubuntu-latest - steps: - - name: Echo current time - run: echo "The current server time is $(date)" 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" From 6d3b37e05b27ac1902d2fa6de4be766de8ab3015 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sun, 16 Nov 2025 12:40:04 +0000 Subject: [PATCH 10/13] should not trigger --- .github/workflows/webhook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index b200d991f..f2994553d 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -12,4 +12,4 @@ jobs: - 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"'' From b636ddbabbaad76e49d7b3b4f5676324deaa7ef0 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sun, 16 Nov 2025 12:54:02 +0000 Subject: [PATCH 11/13] do not trigger --- .github/workflows/webhook.yml | 2 +- github-actions/Readme.me | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index f2994553d..5c175d8da 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -12,4 +12,4 @@ jobs: - 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"' diff --git a/github-actions/Readme.me b/github-actions/Readme.me index 9be613aad..78c4b9b4d 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -10,7 +10,7 @@ echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json ```sh curl -X POST \ -H "Accept: application/vnd.github+json" \ --H "Authorization: token {PAT} \ +-H "Authorization: token "" \ -d '{"event_type": "webhook", "client_payload": {"key": "value"} }' \ -https://api.github.com/repos/{owner}/{repo}/dispatches +https://api.github.com/repos/Agnesakpa/Github-Examples/dispatches ``` \ No newline at end of file From 705e83eb150980f50ea93169b6c3e2615304009f Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sun, 16 Nov 2025 14:00:58 +0100 Subject: [PATCH 12/13] conditional --- .github/workflows/conditional.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/conditional.yml diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml new file mode 100644 index 000000000..87b48c2f9 --- /dev/null +++ b/.github/workflows/conditional.yml @@ -0,0 +1,14 @@ +name: example-workflow +on: [push] +jobs: + hello-world: + if: github.repository == 'octo-org/octo-repo-prod' + 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!" \ No newline at end of file From 7c4cb2ca253f016a74a0466e4c08932e993757a1 Mon Sep 17 00:00:00 2001 From: Akpa Agnes Odachi <100244200+Agnesakpa@users.noreply.github.com> Date: Sun, 16 Nov 2025 14:03:12 +0100 Subject: [PATCH 13/13] conditional modified --- .github/workflows/conditional.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml index 87b48c2f9..196a377f3 100644 --- a/.github/workflows/conditional.yml +++ b/.github/workflows/conditional.yml @@ -2,7 +2,7 @@ name: example-workflow on: [push] jobs: hello-world: - if: github.repository == 'octo-org/octo-repo-prod' + if: github.repository == 'Agnesakpa/Github-Examples' runs-on: ubuntu-latest steps: - name: "Hello World"