From a1e7e4a37b60a37565344182ef62b687b91bdd18 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Tue, 27 May 2025 15:46:56 +0200 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 915fd117fc21511729cb2301a2f247b031578461 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Tue, 27 May 2025 16:08:39 +0200 Subject: [PATCH 02/28] move samples --- .github/workflows/greetings.yml | 16 ---------------- github-actions/templates/greetings.yml | 1 - 2 files changed, 17 deletions(-) delete mode 100644 .github/workflows/greetings.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-actions/templates/greetings.yml b/github-actions/templates/greetings.yml index 996da6bbd..46774343e 100644 --- a/github-actions/templates/greetings.yml +++ b/github-actions/templates/greetings.yml @@ -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 21487f365331b5244fc0ee193fc6d35bbe50d4cc Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Tue, 27 May 2025 16:09:57 +0200 Subject: [PATCH 03/28] delete --- .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 772af589dd93cdfc6cacdeebe5f538fc2ed1681a Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Tue, 27 May 2025 16:33:04 +0200 Subject: [PATCH 04/28] 2 minutes cron --- .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 9fff549a054b817cf74be194943c8ff664bfe64e Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 11:09:45 +0200 Subject: [PATCH 05/28] 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 f89ec8a67a7ce2b27f1e61e0d93e0e92bf9fcc8c Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 10:24:56 +0000 Subject: [PATCH 06/28] my 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 ca8b32d3e54dd258a27478ceca5100e02dc0d640 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 12:22:10 +0000 Subject: [PATCH 07/28] push changes --- .github/workflows/multi-event.yml | 19 ------------------- .github/workflows/schedule.yml | 10 ---------- 2 files changed, 29 deletions(-) delete mode 100644 .github/workflows/multi-event.yml delete mode 100644 .github/workflows/schedule.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 diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml deleted file mode 100644 index 9ae566778..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)" From 2fd7bc2536329ccb2cae48147a0d4aef02760609 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 12:50:41 +0000 Subject: [PATCH 08/28] add webhook --- .github/workflows/manual.yml | 32 -------------------------------- .github/workflows/webhook.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 32 deletions(-) delete mode 100644 .github/workflows/manual.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/webhook.yml b/.github/workflows/webhook.yml new file mode 100644 index 000000000..dbdf1e47d --- /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 fb33a51ddfdc4cb7a63525a3c14b7c479aae4a91 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 12:52:54 +0000 Subject: [PATCH 09/28] custom wh --- .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 dbdf1e47d..f657be2e6 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -3,7 +3,7 @@ name: "Webhook Event example" on: repository_dispatch: types: - - webhook + - custom_webhook jobs: respond-to-dispatch: From 81f5ae839806907371577823b506b2bd4427a6cc Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 12:56:08 +0000 Subject: [PATCH 10/28] fix syntax --- .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 f657be2e6..b200d991f 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -3,13 +3,13 @@ name: "Webhook Event example" on: repository_dispatch: types: - - custom_webhook + - webhook 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 4f02b9fe2cc7f925a2d166861eab08fcb9a88e24 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 12:58:16 +0000 Subject: [PATCH 11/28] ? --- .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..29b950b6f 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" \ No newline at end of file From 6d3aa64dcbef6416cdc5ca734e7a27314ba65ca1 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 13:00:21 +0000 Subject: [PATCH 12/28] ?? --- .github/workflows/webhook.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index 29b950b6f..ef5abcac6 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -11,5 +11,6 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v2 + - name: Run a script run: echo "Event of type: $GITHUB_EVENT_NAME" \ No newline at end of file From 0467fff4fbb035bc61a0fc6965a453b97db6f234 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 13:01:54 +0000 Subject: [PATCH 13/28] ??? --- .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 ef5abcac6..c89e77a33 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -13,4 +13,4 @@ jobs: uses: actions/checkout@v2 - name: Run a script - run: echo "Event of type: $GITHUB_EVENT_NAME" \ No newline at end of file + run: cat $GITHUB_EVENT_PATH \ No newline at end of file From 2fce10fe6d493994cf8ab981a314da5f99d32343 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:30:28 +0200 Subject: [PATCH 14/28] 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 8b3a3062017c9d89d8806437f45050ceb8c9a76d Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:31:50 +0200 Subject: [PATCH 15/28] push --- .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..a5335831c 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 == 'matdm29/Github-Examples' runs-on: ubuntu-latest steps: - name: "Hello World" From 59e85de097ee5816f7632f3654be5983ce72d931 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:39:22 +0200 Subject: [PATCH 16/28] expression func example --- .github/workflows/conditional.yml | 14 --------- .github/workflows/expression-functions.yml | 35 ++++++++++++++++++++++ .github/workflows/webhook.yml | 16 ---------- 3 files changed, 35 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/conditional.yml create mode 100644 .github/workflows/expression-functions.yml delete mode 100644 .github/workflows/webhook.yml diff --git a/.github/workflows/conditional.yml b/.github/workflows/conditional.yml deleted file mode 100644 index a5335831c..000000000 --- a/.github/workflows/conditional.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: example-workflow -on: [push] -jobs: - hello-world: - if: github.repository == 'matdm29/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..ad3cf229d --- /dev/null +++ b/.github/workflows/expression-functions.yml @@ -0,0 +1,35 @@ +name: Expression Functions Demo + +on: + push: + branches: + - main + +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 diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml deleted file mode 100644 index c89e77a33..000000000 --- a/.github/workflows/webhook.yml +++ /dev/null @@ -1,16 +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: cat $GITHUB_EVENT_PATH \ No newline at end of file From 57e9a4205d2d4f7c91f79257455cc7a4eb5839c8 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:41:36 +0200 Subject: [PATCH 17/28] cat --- .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 ad3cf229d..63d546abe 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: @@ -19,16 +21,16 @@ jobs: 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') }} + run: cat ${{ 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: cat "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}" - name: Convert job context to JSON - run: echo "Job context in JSON: ${{ toJSON(github.job) }}" + run: cat "Job context in JSON: ${{ toJSON(github.job) }}" - name: Parse JSON string - run: echo "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}" + run: cat "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}" - name: Hash files - run: echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} + run: cat "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }} - name: The job has succeeded if: ${{ success() }} - name: The job has failed From c28313b1782a5be2013c966d8940d550005882aa Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:45:26 +0200 Subject: [PATCH 18/28] try fix --- .github/workflows/expression-functions.yml | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 63d546abe..fc8d62b79 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: @@ -14,24 +12,35 @@ jobs: - 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: cat ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }} + run: echo "${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}" + - name: Join issue labels if: github.event_name == 'issues' - run: cat "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: cat "Job context in JSON: ${{ toJSON(github.job) }}" + run: echo "Job context in JSON: ${{ toJSON(github.job) }}" + - name: Parse JSON string - run: cat "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}" + run: echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}" + - name: Hash files - run: cat "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 succeeded!" + - name: The job has failed - if: ${{ failure() }} \ No newline at end of file + if: ${{ failure() }} + run: echo "The job failed!" \ No newline at end of file From d9500a057ebd32cedea12675c76191cecdd21ccb Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:47:01 +0200 Subject: [PATCH 19/28] try fix 2 --- .github/workflows/expression-functions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index fc8d62b79..c8f9b91a0 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, unlabeled] jobs: expression-functions: From e557ef78370048e4c28ff89b874e8737803fbe40 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:48:25 +0200 Subject: [PATCH 20/28] try fux 3 --- .github/workflows/expression-functions.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index c8f9b91a0..7734e0f1c 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -28,7 +28,9 @@ jobs: - name: Join issue labels if: github.event_name == 'issues' - run: echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}" + run: | + echo "Issue labels:" + echo "${{ toJSON(github.event.issue.labels) }}" - name: Convert job context to JSON run: echo "Job context in JSON: ${{ toJSON(github.job) }}" From c2e718238bce2325335c8c8a1a1b2506524bf5ed Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 15:50:31 +0200 Subject: [PATCH 21/28] fix 4 --- .github/workflows/expression-functions.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 7734e0f1c..856c86406 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -29,14 +29,18 @@ jobs: - name: Join issue labels if: github.event_name == 'issues' run: | - echo "Issue labels:" - echo "${{ toJSON(github.event.issue.labels) }}" + echo "Issue labels:" + echo "${{ toJSON(github.event.issue.labels) }}" - name: Convert job context to JSON - run: echo "Job context in JSON: ${{ toJSON(github.job) }}" + run: | + echo "Job context in JSON:" + echo "${{ toJSON(job) }}" - name: Parse JSON string - run: echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}" + run: | + echo "Parsed JSON:" + echo "${{ fromJSON('{\"hello\":\"world\"}').hello }}" - name: Hash files run: echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}" From 582eed343ee78a9ae2644e46dd347f0c2201ca73 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 16:40:31 +0200 Subject: [PATCH 22/28] runners 4 macos e winds --- .github/workflows/expression-functions.yml | 54 ---------------------- .github/workflows/runner-macos.yml | 30 ++++++++++++ .github/workflows/runner-windows.yml | 35 ++++++++++++++ 3 files changed, 65 insertions(+), 54 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 856c86406..000000000 --- a/.github/workflows/expression-functions.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Expression Functions Demo - -on: - push: - branches: - - main - issues: - types: [opened, labeled, unlabeled] - -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:" - echo "${{ toJSON(github.event.issue.labels) }}" - - - name: Convert job context to JSON - run: | - echo "Job context in JSON:" - echo "${{ toJSON(job) }}" - - - name: Parse JSON string - run: | - echo "Parsed JSON:" - echo "${{ 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..33b7e05e9 --- /dev/null +++ b/.github/workflows/runner-windows.yml @@ -0,0 +1,35 @@ +name: Windows Workflow Example + +on: + push: + 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 0670c7d2d9ee38a9ede50b1101f127a182564e55 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 17:12:16 +0200 Subject: [PATCH 23/28] example --- .github/workflows/runner-macos.yml | 30 --------------------- .github/workflows/runner-windows.yml | 35 ------------------------- .github/workflows/workflow-commands.yml | 12 +++++++++ 3 files changed, 12 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/runner-macos.yml delete mode 100644 .github/workflows/runner-windows.yml create mode 100644 .github/workflows/workflow-commands.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 33b7e05e9..000000000 --- a/.github/workflows/runner-windows.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Windows Workflow Example - -on: - push: - 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 diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml new file mode 100644 index 000000000..f0b60e466 --- /dev/null +++ b/.github/workflows/workflow-commands.yml @@ -0,0 +1,12 @@ +name: "Workflow commands" + +on: ['push'] + +jobs: + my-job: + runs_on: ubuntu-latest + steps: + - name: "group logging" + runs: | + echo "msg1" + echo "msg2" From 55b6a754933dc4e1409313a4d29c4622fa29008e Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 17:13:17 +0200 Subject: [PATCH 24/28] run fix --- .github/workflows/workflow-commands.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml index f0b60e466..a5efe2ecd 100644 --- a/.github/workflows/workflow-commands.yml +++ b/.github/workflows/workflow-commands.yml @@ -7,6 +7,6 @@ jobs: runs_on: ubuntu-latest steps: - name: "group logging" - runs: | + run: | echo "msg1" echo "msg2" From daf53826d8afe99612f18e966bc639b865588094 Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Thu, 29 May 2025 17:13:43 +0200 Subject: [PATCH 25/28] runs-on --- .github/workflows/workflow-commands.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml index a5efe2ecd..c67cce3be 100644 --- a/.github/workflows/workflow-commands.yml +++ b/.github/workflows/workflow-commands.yml @@ -4,7 +4,7 @@ on: ['push'] jobs: my-job: - runs_on: ubuntu-latest + runs-on: ubuntu-latest steps: - name: "group logging" run: | From 3bd3ee492da3f563376f3376437a10c1791d8bad Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:05:27 +0200 Subject: [PATCH 26/28] attempt context --- .github/workflows/context.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/context.yml diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml new file mode 100644 index 000000000..9a45c30bd --- /dev/null +++ b/.github/workflows/context.yml @@ -0,0 +1,12 @@ +name : Context Examples + +on: ['push'] + +jobs: + my-Context: + runs-on: ubuntu-latest + steps: + env: + MY_ACTION: ${{ github.action }} + - name: "My step" + run: echo "Hello. $MY_ACTION" \ No newline at end of file From 73fcab4b4768af99ca5c1045d7f04785187fdded Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:06:28 +0200 Subject: [PATCH 27/28] attempt --- .github/workflows/context.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index 9a45c30bd..d34d01e89 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -5,8 +5,8 @@ on: ['push'] jobs: my-Context: runs-on: ubuntu-latest - steps: - env: - MY_ACTION: ${{ github.action }} + steps: - name: "My step" - run: echo "Hello. $MY_ACTION" \ No newline at end of file + run: echo "Hello. $MY_ACTION" + env: + MY_ACTION: ${{ github.action }} \ No newline at end of file From e2d44efdfc855ac81f413006cdc6ba0b7fc836ec Mon Sep 17 00:00:00 2001 From: matdm29 <80325272+matdm29@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:23:29 +0200 Subject: [PATCH 28/28] actor --- .github/workflows/context.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index d34d01e89..48775c773 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -7,6 +7,9 @@ jobs: runs-on: ubuntu-latest steps: - name: "My step" - run: echo "Hello. $MY_ACTION" + run: | + echo "Hello. $MY_ACTION" + echo "Actor! $MY_ACTOR" env: - MY_ACTION: ${{ github.action }} \ No newline at end of file + MY_ACTION: ${{ github.action }} + MY_ACTOR: ${{ github.actor}} \ No newline at end of file