From 786ed929da9791da42432db1f871a55222a1385a Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 16:34:40 +0530 Subject: [PATCH 01/28] 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 c87a6f705405801d0a21d53428c5a9ee3e3cd14a Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 17:26:37 +0530 Subject: [PATCH 02/28] commit and push --- .github/workflows/schedule.yml | 10 ++++++++++ github-actions/templates/greetings copy.yml | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/schedule.yml create mode 100644 github-actions/templates/greetings copy.yml diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml new file mode 100644 index 000000000..bde1d99b2 --- /dev/null +++ b/.github/workflows/schedule.yml @@ -0,0 +1,10 @@ +on: + schedule: + - cron: '*/5 * * * *' + +jobs: + hello_world: + runs-on: ubuntu-latest + steps: + - name: Echo current time + run: echo "The current server time is $(date)" \ No newline at end of file diff --git a/github-actions/templates/greetings copy.yml b/github-actions/templates/greetings copy.yml new file mode 100644 index 000000000..46774343e --- /dev/null +++ b/github-actions/templates/greetings copy.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 45f539ea06517aaa60c3be2c7e9028f9513b5538 Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 17:27:28 +0530 Subject: [PATCH 03/28] commit and push --- .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 bde1d99b2..ec880ee68 100644 --- a/.github/workflows/schedule.yml +++ b/.github/workflows/schedule.yml @@ -1,6 +1,6 @@ on: schedule: - - cron: '*/5 * * * *' + - cron: '*/2 * * * *' jobs: hello_world: From dd2bcc0772d393b6dde32ce25acaae54b2c69d24 Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 18:23:04 +0530 Subject: [PATCH 04/28] commit and push --- .github/workflows/schedule.yml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/workflows/schedule.yml diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml deleted file mode 100644 index ec880ee68..000000000 --- a/.github/workflows/schedule.yml +++ /dev/null @@ -1,10 +0,0 @@ -on: - schedule: - - cron: '*/2 * * * *' - -jobs: - hello_world: - runs-on: ubuntu-latest - steps: - - name: Echo current time - run: echo "The current server time is $(date)" \ No newline at end of file From e3d20ff0004d4015b900702a6de47687b1f5d9fe Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 19:15:59 +0530 Subject: [PATCH 05/28] multi branch workflow --- .github/workflows/custom-action.yml | 15 --------------- .github/workflows/greetings.yml | 16 ---------------- .github/workflows/multi-event.yml | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/custom-action.yml delete mode 100644 .github/workflows/greetings.yml create mode 100644 .github/workflows/multi-event.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 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/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 4c15aac51e8801d687fdd64c43af258e6eb99889 Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 19:38:55 +0530 Subject: [PATCH 06/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43fc9143d..cdcba642b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Github-Examples -A repo containing GitHub for programmatic examples +A repo containing GitHub for programmatic examples From 671e7e9aaf4dc55fe6c99a335a0c6d5373aef0bb Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 19:43:06 +0530 Subject: [PATCH 07/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdcba642b..43fc9143d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Github-Examples -A repo containing GitHub for programmatic examples +A repo containing GitHub for programmatic examples From 8ebb3cdf50a1a71e857e11b7dc509b91c7037b19 Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 19:48:14 +0530 Subject: [PATCH 08/28] Delete .github/workflows/multi-event.yml --- .github/workflows/multi-event.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .github/workflows/multi-event.yml 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 From db8dfcc5969ba2b16e9190d8c61c1fb536d69ac1 Mon Sep 17 00:00:00 2001 From: tamilselvansellamuthu <45310733+tamilselvansellamuthu@users.noreply.github.com> Date: Sat, 6 Sep 2025 20:25:21 +0530 Subject: [PATCH 09/28] manual trigger --- .github/workflows/manual.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/mydata | 1 + 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/manual.yml create mode 100644 .github/workflows/mydata 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 diff --git a/.github/workflows/mydata b/.github/workflows/mydata new file mode 100644 index 000000000..79a7bfef2 --- /dev/null +++ b/.github/workflows/mydata @@ -0,0 +1 @@ +REVDT0RFRA== \ No newline at end of file From 4ebb75d1bb62da4a8d62658f6a1df52c18276ce6 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 05:23:45 +0530 Subject: [PATCH 10/28] remove manual --- .github/workflows/manual.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/manual.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 From ee0f1fb2509c9d52e377d495df534fee802ce366 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 05:25:19 +0530 Subject: [PATCH 11/28] no manual data --- .github/workflows/mydata | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/workflows/mydata diff --git a/.github/workflows/mydata b/.github/workflows/mydata deleted file mode 100644 index 79a7bfef2..000000000 --- a/.github/workflows/mydata +++ /dev/null @@ -1 +0,0 @@ -REVDT0RFRA== \ No newline at end of file From 70cc97036a173171226414058b98a7a886a1ca8e Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 05:27:42 +0530 Subject: [PATCH 12/28] webhook.yml --- .github/workflows/webhook.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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..7f2ed7466 --- /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 d38469d237dee2592e2a9f981c195cd44d0cf0ab Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 18:55:06 +0530 Subject: [PATCH 13/28] conditional --- .github/workflows/conditional.yml | 14 ++++++++++++++ .github/workflows/webhook.yml | 15 --------------- 2 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/conditional.yml delete mode 100644 .github/workflows/webhook.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 diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml deleted file mode 100644 index 7f2ed7466..000000000 --- a/.github/workflows/webhook.yml +++ /dev/null @@ -1,15 +0,0 @@ -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 643587867493cf82c34c74b47305ce520a1dc683 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 18:56:44 +0530 Subject: [PATCH 14/28] 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..0d0c69e09 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 == 'tamilselvansellamuthu/Github-Examples' runs-on: ubuntu-latest steps: - name: "Hello World" From e97da72349be078ef920f06686f4b97c7e82622a Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:08:28 +0530 Subject: [PATCH 15/28] conditional --- .github/workflows/conditional.yml | 14 -------- .github/workflows/expression-functions.yml | 37 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 14 deletions(-) delete mode 100644 .github/workflows/conditional.yml create mode 100644 .github/workflows/expression-functions.yml diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml deleted file mode 100644 index 0d0c69e09..000000000 --- a/.github/workflows/conditional.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: example-workflow -on: [push] -jobs: - hello-world: - if: github.repository == 'tamilselvansellamuthu/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!" \ No newline at end of file diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml new file mode 100644 index 000000000..e213a386b --- /dev/null +++ b/.github/workflows/expression-functions.yml @@ -0,0 +1,37 @@ +name: Expression Functions Demo + +on: + push: + branches: + - main + issues: + types: [opened, labeled] + +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: Join issue labels + if: github.event_name == 'issues' + 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) }}" + - 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() }} + - name: The job has failed + if: ${{ failure() }} \ No newline at end of file From 8e6c8f11942fd6133aec8d28bd7243ae2ee21f8a Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:16:16 +0530 Subject: [PATCH 16/28] expression function --- .github/workflows/expression-functions.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index e213a386b..50887b023 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -24,14 +24,20 @@ 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 "The job has succeeded." - name: The job has failed - if: ${{ failure() }} \ No newline at end of file + if: ${{ failure() }} + run: echo "The job has failed." \ No newline at end of file From fde2bf31e5accb87fe47b67d59d57f59ea4dae87 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:21:19 +0530 Subject: [PATCH 17/28] expression function modified. --- .github/workflows/expression-functions.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 50887b023..5b80c694f 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -4,8 +4,6 @@ on: push: branches: - main - issues: - types: [opened, labeled] jobs: expression-functions: From d2d2056a07cb88ce249c23928d8f27c00f7f2914 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:23:20 +0530 Subject: [PATCH 18/28] expression updated. --- .github/workflows/expression-functions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 5b80c694f..5d927c402 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -32,7 +32,7 @@ jobs: echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}" - name: Hash files run: | - echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} + echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} - name: The job has succeeded if: ${{ success() }} run: echo "The job has succeeded." From 3d043e8ac4d102372773f4b1d9b0ce61bdebc146 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:28:44 +0530 Subject: [PATCH 19/28] fix expression --- .github/workflows/expression-functions.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 5d927c402..51d5b1b01 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -4,6 +4,8 @@ on: push: branches: - main + issues: + types: [opened, labeled] jobs: expression-functions: @@ -23,19 +25,19 @@ jobs: - name: Join issue labels if: github.event_name == 'issues' run: | - echo \"Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}\"" + echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}" - name: Convert job context to JSON run: | - echo 'Job context in JSON: ${{ toJSON(github.job) }}' + echo "Job context in JSON: ${{ toJSON(github.job) }}" - name: Parse JSON string run: | - echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}" + 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 "The job has succeeded." + run: echo "The job succeeded." - name: The job has failed if: ${{ failure() }} - run: echo "The job has failed." \ No newline at end of file + run: echo "The job failed." \ No newline at end of file From 5515ad7ae780aa18620939458004d9610b72a689 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:29:55 +0530 Subject: [PATCH 20/28] fix expression --- .github/workflows/expression-functions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 51d5b1b01..990d7f5f9 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -34,7 +34,7 @@ jobs: echo "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}" - name: Hash files run: | - echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} + echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}" - name: The job has succeeded if: ${{ success() }} run: echo "The job succeeded." From 526201671ea888438ca8eebe8e1244f4592c7d95 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 19:42:07 +0530 Subject: [PATCH 21/28] runners mac and windows --- .github/workflows/expression-functions.yml | 43 ---------------------- .github/workflows/runner-macos.yml | 30 +++++++++++++++ .github/workflows/runner-windows.yml | 38 +++++++++++++++++++ 3 files changed, 68 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/expression-functions.yml create mode 100644 .github/workflows/runner-macos.yml create mode 100644 .github/workflows/runner-windows.yml diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml deleted file mode 100644 index 990d7f5f9..000000000 --- a/.github/workflows/expression-functions.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Expression Functions Demo - -on: - push: - branches: - - main - issues: - types: [opened, labeled] - -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: Join issue labels - if: github.event_name == 'issues' - 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) }}" - - 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 "The job succeeded." - - name: The job has failed - if: ${{ failure() }} - run: echo "The job failed." \ No newline at end of file diff --git a/.github/workflows/runner-macos.yml b/.github/workflows/runner-macos.yml new file mode 100644 index 000000000..6baa5adf6 --- /dev/null +++ b/.github/workflows/runner-macos.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/runner-windows.yml b/.github/workflows/runner-windows.yml new file mode 100644 index 000000000..3b73f2b2e --- /dev/null +++ b/.github/workflows/runner-windows.yml @@ -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 \ No newline at end of file From 663b7da2d1628e139fc51ff3148c2e84dc42f708 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 20:03:52 +0530 Subject: [PATCH 22/28] clean up mac windows runners --- .github/workflows/runner-macos.yml | 30 ---------------------- .github/workflows/runner-windows.yml | 38 ---------------------------- 2 files changed, 68 deletions(-) delete mode 100644 .github/workflows/runner-macos.yml delete mode 100644 .github/workflows/runner-windows.yml diff --git a/.github/workflows/runner-macos.yml b/.github/workflows/runner-macos.yml deleted file mode 100644 index 6baa5adf6..000000000 --- a/.github/workflows/runner-macos.yml +++ /dev/null @@ -1,30 +0,0 @@ -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 \ No newline at end of file diff --git a/.github/workflows/runner-windows.yml b/.github/workflows/runner-windows.yml deleted file mode 100644 index 3b73f2b2e..000000000 --- a/.github/workflows/runner-windows.yml +++ /dev/null @@ -1,38 +0,0 @@ -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 \ No newline at end of file From 7013c6939945a44793476742c62c3fe647f41db5 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 20:09:08 +0530 Subject: [PATCH 23/28] group message fix --- .github/workflows/worflow-commands.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/worflow-commands.yml diff --git a/.github/workflows/worflow-commands.yml b/.github/workflows/worflow-commands.yml new file mode 100644 index 000000000..a77d0ade9 --- /dev/null +++ b/.github/workflows/worflow-commands.yml @@ -0,0 +1,17 @@ +name: "workflow for group message" +on: [push] +jobs: + group-message: + runs-on: ubuntu-latest + steps: + - name: "Group message" + run: | + echo | + "::group::This is a group message example." + echo "This is a line inside the group." + echo "Job context in JSON: ${{ toJSON(github.job) }}" + echo "Job ref in JSON: ${{ toJSON(github.ref) }}" + echo "Job sha in JSON: ${{ toJSON(github.sha) }}" + echo "Another line inside the group." + echo "You can collapse and expand this section in the logs." + "::endgroup::" \ No newline at end of file From fedae04a72a142d83361b8e0e782421348033495 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 20:10:34 +0530 Subject: [PATCH 24/28] group messge in workflow commands fix --- .github/workflows/worflow-commands.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/worflow-commands.yml b/.github/workflows/worflow-commands.yml index a77d0ade9..07f24dee1 100644 --- a/.github/workflows/worflow-commands.yml +++ b/.github/workflows/worflow-commands.yml @@ -6,8 +6,7 @@ jobs: steps: - name: "Group message" run: | - echo | - "::group::This is a group message example." + echo "::group::This is a group message example." echo "This is a line inside the group." echo "Job context in JSON: ${{ toJSON(github.job) }}" echo "Job ref in JSON: ${{ toJSON(github.ref) }}" From fd7bac3cfea1fe950ff275a4d9de75177c843965 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 20:12:48 +0530 Subject: [PATCH 25/28] fix workflow commands --- .github/workflows/worflow-commands.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/worflow-commands.yml b/.github/workflows/worflow-commands.yml index 07f24dee1..338ad1c22 100644 --- a/.github/workflows/worflow-commands.yml +++ b/.github/workflows/worflow-commands.yml @@ -7,10 +7,10 @@ jobs: - name: "Group message" run: | echo "::group::This is a group message example." - echo "This is a line inside the group." - echo "Job context in JSON: ${{ toJSON(github.job) }}" - echo "Job ref in JSON: ${{ toJSON(github.ref) }}" - echo "Job sha in JSON: ${{ toJSON(github.sha) }}" - echo "Another line inside the group." - echo "You can collapse and expand this section in the logs." - "::endgroup::" \ No newline at end of file + echo "This is a line inside the group." + echo "Job context in JSON: ${{ toJSON(github.job) }}" + echo "Job ref in JSON: ${{ toJSON(github.ref) }}" + echo "Job sha in JSON: ${{ toJSON(github.sha) }}" + echo "Another line inside the group." + echo "You can collapse and expand this section in the logs." + echo "::endgroup::" \ No newline at end of file From db12f9b2439445ce34da469771c020db70811623 Mon Sep 17 00:00:00 2001 From: Tamil Date: Sun, 7 Sep 2025 20:18:37 +0530 Subject: [PATCH 26/28] set and get environment variable --- .github/workflows/worflow-commands.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/worflow-commands.yml b/.github/workflows/worflow-commands.yml index 338ad1c22..880c2028d 100644 --- a/.github/workflows/worflow-commands.yml +++ b/.github/workflows/worflow-commands.yml @@ -13,4 +13,8 @@ jobs: echo "Job sha in JSON: ${{ toJSON(github.sha) }}" echo "Another line inside the group." echo "You can collapse and expand this section in the logs." - echo "::endgroup::" \ No newline at end of file + echo "::endgroup::" + - name: "Set environment variable" + run: echo "NAME=GTS" >> $GITHUB_ENV + - name: "Display environment variable" + run: echo "The value of NAME is $NAME" \ No newline at end of file From 42b48de1d32a380208d39e0d4369c1c1af5fa8b6 Mon Sep 17 00:00:00 2001 From: Tamil Date: Tue, 9 Sep 2025 21:58:31 +0530 Subject: [PATCH 27/28] context --- .github/workflows/context.yml | 45 +++++++++++++++++++ .../templates}/worflow-commands.yml | 0 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/context.yml rename {.github/workflows => github-actions/templates}/worflow-commands.yml (100%) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml new file mode 100644 index 000000000..5b115e0bf --- /dev/null +++ b/.github/workflows/context.yml @@ -0,0 +1,45 @@ +name: Context Examples +on: [push] +jobs: + my-context: + runs-on: ubuntu-latest + steps: + - name: "Display job context" + run: | + echo "Job context in JSON: ${{ toJSON(github.job) }}" + echo "Job ref in JSON: ${{ toJSON(github.ref) }}" + echo "Job sha in JSON: ${{ toJSON(github.sha) }}" + - name: "Display runner context" + run: | + echo "Runner OS: ${{ runner.os }}" + echo "Runner Temp Directory: ${{ runner.temp }}" + echo "Runner Tool Cache Directory: ${{ runner.tool_cache }}" + - name: "Display event context" + run: | + echo "Event name: ${{ github.event_name }}" + echo "Event action (if applicable): ${{ github.event.action || 'N/A' }}" + echo "Event repository name: ${{ github.event.repository.name }}" + echo "Event sender login: ${{ github.event.sender.login }}" + - name: "Display workflow context" + run: | + echo "Workflow name: ${{ github.workflow }}" + echo "Workflow run ID: ${{ github.run_id }}" + echo "Workflow run number: ${{ github.run_number }}" + echo "Workflow actor: ${{ github.actor }}" + - name: "Display repository context" + run: | + echo "Repository name: ${{ github.repository }}" + echo "Repository owner: ${{ github.repository_owner }}" + echo "Default branch: ${{ github.ref_name || 'N/A' }}" + - name: "Display commit context" + run: | + echo "Commit SHA: ${{ github.sha }}" + echo "Commit message: ${{ github.event.head_commit.message || 'N/A' }}" + echo "Commit author name: ${{ github.event.head_commit.author.name || 'N/A' }}" + - name: "Set and display environment variable" + run: | + echo "Setting environment variable MY_VAR to 'HelloWorld'" + echo "MY_VAR=HelloWorld" >> $GITHUB_ENV + - name: "Display the environment variable" + run: | + echo "The value of MY_VAR is $MY_VAR" \ No newline at end of file diff --git a/.github/workflows/worflow-commands.yml b/github-actions/templates/worflow-commands.yml similarity index 100% rename from .github/workflows/worflow-commands.yml rename to github-actions/templates/worflow-commands.yml From e011b64dfe1ce9663eddf335b0f0682e681a28b3 Mon Sep 17 00:00:00 2001 From: Tamil Date: Wed, 10 Sep 2025 05:45:36 +0530 Subject: [PATCH 28/28] dependent jobs --- .github/workflows/dependent-jobs.yml | 31 +++++++++++++++++++ .../templates}/context.yml | 0 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/dependent-jobs.yml rename {.github/workflows => github-actions/templates}/context.yml (100%) diff --git a/.github/workflows/dependent-jobs.yml b/.github/workflows/dependent-jobs.yml new file mode 100644 index 000000000..6c6a1752a --- /dev/null +++ b/.github/workflows/dependent-jobs.yml @@ -0,0 +1,31 @@ +name: Build, Test, and Deploy Workflow + +on: + push: + branches: + - main + +jobs: + deploy: + needs: [build, test] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Deploy application + run: echo "Deploying to production..." + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build application + run: echo "Building the application..." + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Test application + run: echo "Running tests..." \ No newline at end of file diff --git a/.github/workflows/context.yml b/github-actions/templates/context.yml similarity index 100% rename from .github/workflows/context.yml rename to github-actions/templates/context.yml