From 9608629cdfed25b3ea80ad750231265f5bab79a5 Mon Sep 17 00:00:00 2001 From: Goran Radanovic Date: Wed, 5 Feb 2025 09:58:49 +0100 Subject: [PATCH 01/37] Create main.yml --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..9ae566778 --- /dev/null +++ b/.github/workflows/main.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 6e5d147b26aa49bfdf16e0da0a4ed2597da9e6de Mon Sep 17 00:00:00 2001 From: Goran Radanovic Date: Wed, 5 Feb 2025 10:03:33 +0100 Subject: [PATCH 02/37] 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 e5bf76f177de4848f08c603ce55417dc6d21f49d Mon Sep 17 00:00:00 2001 From: Goran Radanovic Date: Wed, 5 Feb 2025 10:11:46 +0100 Subject: [PATCH 03/37] 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 ec95428b30d16d6b124545d949983ac49905a7f6 Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 10:32:57 +0100 Subject: [PATCH 04/37] Add manual trigger workflow and update README with usage instructions --- .github/workflows/manual.yml | 32 +++++++++++++++++++++++++ github-actions/{Readme.me => Readme.md} | 0 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/manual.yml rename github-actions/{Readme.me => Readme.md} (100%) 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-actions/Readme.me b/github-actions/Readme.md similarity index 100% rename from github-actions/Readme.me rename to github-actions/Readme.md From 0c3b481fc24a07e478952f0d6428b22ad0080f84 Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 11:39:31 +0100 Subject: [PATCH 05/37] Remove obsolete workflow files and add webhook event example --- .github/workflows/custom-action.yml | 15 -------------- .github/workflows/greetings.yml | 16 --------------- .github/workflows/main.yml | 10 --------- .github/workflows/manual.yml | 32 ----------------------------- .github/workflows/multi-event.yml | 19 ----------------- .github/workflows/webhook.yml | 15 ++++++++++++++ 6 files changed, 15 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/custom-action.yml delete mode 100644 .github/workflows/greetings.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/manual.yml delete mode 100644 .github/workflows/multi-event.yml create mode 100644 .github/workflows/webhook.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/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 9ae566778..000000000 --- a/.github/workflows/main.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)" 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/webhook.yml b/.github/workflows/webhook.yml new file mode 100644 index 000000000..29b950b6f --- /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" \ No newline at end of file From 99eb7eebdbada0ae4f193f2ccecc2879e2ac93cd Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 11:40:38 +0100 Subject: [PATCH 06/37] Fix syntax for echo command in webhook.yml --- .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 29b950b6f..738211a78 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" \ No newline at end of file + run: 'echo "Event of type: $GITHUB_EVENT_NAME"' \ No newline at end of file From 1d5f44944d026fa7e072fe5e4dd1ea60fc866b5a Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 13:55:31 +0100 Subject: [PATCH 07/37] Remove obsolete webhook.yml and fix syntax in template; add new conditional workflow --- .github/workflows/conditional.yml | 14 ++++++++++++++ .github/workflows/mydata | 1 + .github/workflows/webhook.yml | 15 --------------- github-actions/templates/webhook.yml | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/conditional.yml create mode 100644 .github/workflows/mydata 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/mydata b/.github/workflows/mydata new file mode 100644 index 000000000..1bea4a2ee --- /dev/null +++ b/.github/workflows/mydata @@ -0,0 +1 @@ +SGVsbG8gTWFycw== \ No newline at end of file diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml deleted file mode 100644 index 738211a78..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"' \ No newline at end of file diff --git a/github-actions/templates/webhook.yml b/github-actions/templates/webhook.yml index dbdf1e47d..738211a78 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" + run: 'echo "Event of type: $GITHUB_EVENT_NAME"' \ No newline at end of file From e9341af17335a83a70dd1f17a201a9754a7a8d43 Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 13:57:21 +0100 Subject: [PATCH 08/37] Update conditional workflow to target the correct repository --- .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..6dd9b75e5 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 == 'goranrad/Github-Examples' runs-on: ubuntu-latest steps: - name: "Hello World" From 96cf5edf6d1ea710d8ad44490e1a173d0ef78bab Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 14:22:04 +0100 Subject: [PATCH 09/37] Expression function --- .github/workflows/conditional.yml | 14 -------- .github/workflows/expression-functions.yml | 39 ++++++++++++++++++++++ 2 files changed, 39 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 6dd9b75e5..000000000 --- a/.github/workflows/conditional.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: example-workflow -on: [push] -jobs: - hello-world: - if: github.repository == 'goranrad/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..5791946ce --- /dev/null +++ b/.github/workflows/expression-functions.yml @@ -0,0 +1,39 @@ +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() }} + echo: The job has succeeded + - name: The job has failed + if: ${{ failure() }} + echo: The job has failed \ No newline at end of file From f6c450dffbcb908371ec0ff80dcfa28e32c4a97a Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 14:29:17 +0100 Subject: [PATCH 10/37] Expression function fix --- .github/workflows/expression-functions.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 5791946ce..276f5be41 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -22,18 +22,15 @@ jobs: 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) }}" + 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() }} - echo: The job has succeeded + run: echo "The job has succeeded" - name: The job has failed if: ${{ failure() }} - echo: The job has failed \ No newline at end of file + run: echo "The job has failed" \ No newline at end of file From 9a66d74820646b44f5115a6a67f40cb9411582aa Mon Sep 17 00:00:00 2001 From: goranrad Date: Thu, 6 Feb 2025 14:46:04 +0100 Subject: [PATCH 11/37] self-hosted runner workflow --- .github/workflows/expression-functions.yml | 36 ---------------------- .github/workflows/mydata | 1 - .github/workflows/runner-self-hosted.yml | 17 ++++++++++ 3 files changed, 17 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/expression-functions.yml delete mode 100644 .github/workflows/mydata create mode 100644 .github/workflows/runner-self-hosted.yml diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml deleted file mode 100644 index 276f5be41..000000000 --- a/.github/workflows/expression-functions.yml +++ /dev/null @@ -1,36 +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: 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 has succeeded" - - name: The job has failed - if: ${{ failure() }} - run: echo "The job has failed" \ No newline at end of file diff --git a/.github/workflows/mydata b/.github/workflows/mydata deleted file mode 100644 index 1bea4a2ee..000000000 --- a/.github/workflows/mydata +++ /dev/null @@ -1 +0,0 @@ -SGVsbG8gTWFycw== \ No newline at end of file diff --git a/.github/workflows/runner-self-hosted.yml b/.github/workflows/runner-self-hosted.yml new file mode 100644 index 000000000..23bb12e71 --- /dev/null +++ b/.github/workflows/runner-self-hosted.yml @@ -0,0 +1,17 @@ +# If you don't create a self-hosted runner you will see: +# Waiting for a runner to pick up this job... +name: Self-hosted Runner Workflow + +on: + push: + branches: + - main + +jobs: + example-job: + runs-on: self-hosted + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Run a one-line script + run: echo "Hello from a self-hosted runner!" \ No newline at end of file From b29ca45208f93e23238f8495441318676d9989d2 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 10:35:44 +0100 Subject: [PATCH 12/37] self-hosted runner --- .github/workflows/expression-functions.yml | 36 ++++++++++++++++++++++ .github/workflows/runner-self-hosted.yml | 3 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/expression-functions.yml diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml new file mode 100644 index 000000000..276f5be41 --- /dev/null +++ b/.github/workflows/expression-functions.yml @@ -0,0 +1,36 @@ +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: 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 has succeeded" + - name: The job has failed + if: ${{ failure() }} + run: echo "The job has failed" \ No newline at end of file diff --git a/.github/workflows/runner-self-hosted.yml b/.github/workflows/runner-self-hosted.yml index 23bb12e71..c88d792f4 100644 --- a/.github/workflows/runner-self-hosted.yml +++ b/.github/workflows/runner-self-hosted.yml @@ -7,7 +7,8 @@ on: branches: - main -jobs: + +jobs: example-job: runs-on: self-hosted steps: From c622ca83263bd0bbf9d95b00e23fc154ffbe5f0f Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 10:47:25 +0100 Subject: [PATCH 13/37] self-hosted runner workflow --- .github/workflows/runner-self-hosted.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/runner-self-hosted.yml b/.github/workflows/runner-self-hosted.yml index c88d792f4..a30baaf81 100644 --- a/.github/workflows/runner-self-hosted.yml +++ b/.github/workflows/runner-self-hosted.yml @@ -7,7 +7,9 @@ on: branches: - main + + jobs: example-job: runs-on: self-hosted From 926345798ac28123839d7b2970c7b4a61f8fa8db Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 10:48:51 +0100 Subject: [PATCH 14/37] self hosted testing --- .github/workflows/expression-functions.yml | 36 ---------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/expression-functions.yml diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml deleted file mode 100644 index 276f5be41..000000000 --- a/.github/workflows/expression-functions.yml +++ /dev/null @@ -1,36 +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: 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 has succeeded" - - name: The job has failed - if: ${{ failure() }} - run: echo "The job has failed" \ No newline at end of file From 4b75e6583d8b8324fa25a44236e24eaa13d43d8d Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 11:33:44 +0100 Subject: [PATCH 15/37] workflow commands --- .github/workflows/runner-self-hosted.yml | 20 -------------------- .github/workflows/workflow-commands.yml | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/runner-self-hosted.yml create mode 100644 .github/workflows/workflow-commands.yml diff --git a/.github/workflows/runner-self-hosted.yml b/.github/workflows/runner-self-hosted.yml deleted file mode 100644 index a30baaf81..000000000 --- a/.github/workflows/runner-self-hosted.yml +++ /dev/null @@ -1,20 +0,0 @@ -# If you don't create a self-hosted runner you will see: -# Waiting for a runner to pick up this job... -name: Self-hosted Runner Workflow - -on: - push: - branches: - - main - - - - -jobs: - example-job: - runs-on: self-hosted - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Run a one-line script - run: echo "Hello from a self-hosted runner!" \ 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..0f742d67d --- /dev/null +++ b/.github/workflows/workflow-commands.yml @@ -0,0 +1,18 @@ +name: "Workflow Commands" + +on: + push: + branches: + - main + +jobs: + my-job: + runs-on: self-hosted + steps: + - name: "group logging" + run: | + echo "::group::This is a group" + echo "Hello" + echo "World" + echo "::endgroup::" + From dd7823c3f7f954cac380f857054f359b33702acb Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 11:42:25 +0100 Subject: [PATCH 16/37] Workflow Commands --- .github/workflows/workflow-commands.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml index 0f742d67d..a7840db0a 100644 --- a/.github/workflows/workflow-commands.yml +++ b/.github/workflows/workflow-commands.yml @@ -15,4 +15,12 @@ jobs: echo "Hello" echo "World" echo "::endgroup::" + + - name: "step 1" + run: | + echo "MY_VAL=hello" >> $GITHUB_ENV + + - name: "step 2" + run: | + echo $My_VAL From 219e0fa74fab25be5e11a841dba9bba7cd45151d Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 11:46:23 +0100 Subject: [PATCH 17/37] test commint tabs --- .github/workflows/workflow-commands.yml | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml index a7840db0a..648fe836a 100644 --- a/.github/workflows/workflow-commands.yml +++ b/.github/workflows/workflow-commands.yml @@ -1,26 +1,26 @@ name: "Workflow Commands" on: - push: - branches: - - main + push: + branches: + - main jobs: - my-job: - runs-on: self-hosted - steps: - - name: "group logging" - run: | - echo "::group::This is a group" - echo "Hello" - echo "World" - echo "::endgroup::" + my-job: + runs-on: self-hosted + steps: + - name: "group logging" + run: | + echo "::group::This is a group" + echo "Hello" + echo "World" + echo "::endgroup::" - - name: "step 1" - run: | - echo "MY_VAL=hello" >> $GITHUB_ENV + - name: "step 1" + run: | + echo "MY_VAL=hello" >> $GITHUB_ENV - - name: "step 2" - run: | - echo $My_VAL + - name: "step 2" + run: | + echo $My_VAL From a117e648d22a0513d673c32823b09671ee767946 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 11:47:02 +0100 Subject: [PATCH 18/37] test agin --- .github/workflows/workflow-commands.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml index 648fe836a..e80ce3ba4 100644 --- a/.github/workflows/workflow-commands.yml +++ b/.github/workflows/workflow-commands.yml @@ -21,6 +21,6 @@ jobs: echo "MY_VAL=hello" >> $GITHUB_ENV - name: "step 2" - run: | - echo $My_VAL + run: | + echo $My_VAL From c87ded21954dfb071cfa9404986beefd23489d8a Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 12:12:08 +0100 Subject: [PATCH 19/37] test again: --- .github/workflows/workflow-comand.yml | 24 +++++++++++++++++ .github/workflows/workflow-commands.yml | 26 ------------------- .../templates/runner-self-hosted.yml | 3 ++- 3 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/workflow-comand.yml delete mode 100644 .github/workflows/workflow-commands.yml diff --git a/.github/workflows/workflow-comand.yml b/.github/workflows/workflow-comand.yml new file mode 100644 index 000000000..70b53caea --- /dev/null +++ b/.github/workflows/workflow-comand.yml @@ -0,0 +1,24 @@ +name: "Workflow Commands" +on: + push: + branches: + - main + +jobs: + my-job: + runs-on: self-hosted + steps: + - name: Check out repository + run: | + echo "::group::This is a group" + echo "Hello" + elho "World" + echo "::endgroup::" + + - name: "Step 1" + run: | + echo "MY_VAL=hello" >> $GITHUB_ENV + + - name: "Step 2" + run: | + echo $MY_VAL diff --git a/.github/workflows/workflow-commands.yml b/.github/workflows/workflow-commands.yml deleted file mode 100644 index e80ce3ba4..000000000 --- a/.github/workflows/workflow-commands.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Workflow Commands" - -on: - push: - branches: - - main - -jobs: - my-job: - runs-on: self-hosted - steps: - - name: "group logging" - run: | - echo "::group::This is a group" - echo "Hello" - echo "World" - echo "::endgroup::" - - - name: "step 1" - run: | - echo "MY_VAL=hello" >> $GITHUB_ENV - - - name: "step 2" - run: | - echo $My_VAL - diff --git a/github-actions/templates/runner-self-hosted.yml b/github-actions/templates/runner-self-hosted.yml index 23bb12e71..4df014d88 100644 --- a/github-actions/templates/runner-self-hosted.yml +++ b/github-actions/templates/runner-self-hosted.yml @@ -14,4 +14,5 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - name: Run a one-line script - run: echo "Hello from a self-hosted runner!" \ No newline at end of file + run: echo "Hello from a self-hosted runner!" + - name: Run a multi-line script \ No newline at end of file From 3902bc4ffbcff0360067b77f101aabe781a7def3 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 12:14:00 +0100 Subject: [PATCH 20/37] one more time --- .github/workflows/workflow-comand.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow-comand.yml b/.github/workflows/workflow-comand.yml index 70b53caea..be0cbcdeb 100644 --- a/.github/workflows/workflow-comand.yml +++ b/.github/workflows/workflow-comand.yml @@ -1,5 +1,6 @@ name: "Workflow Commands" -on: + +on: push: branches: - main @@ -8,17 +9,17 @@ jobs: my-job: runs-on: self-hosted steps: - - name: Check out repository + - name: "group logging" run: | echo "::group::This is a group" echo "Hello" - elho "World" + echo "World" echo "::endgroup::" - - - name: "Step 1" + + - name: "step 1" run: | echo "MY_VAL=hello" >> $GITHUB_ENV - - name: "Step 2" + - name: "step 2" run: | - echo $MY_VAL + echo $My_VAL \ No newline at end of file From 1acd3d0d99552f0008692aa4180973b9777412eb Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 12:16:04 +0100 Subject: [PATCH 21/37] zappa --- .github/workflows/workflow-comand.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-comand.yml b/.github/workflows/workflow-comand.yml index be0cbcdeb..9981e18b0 100644 --- a/.github/workflows/workflow-comand.yml +++ b/.github/workflows/workflow-comand.yml @@ -22,4 +22,4 @@ jobs: - name: "step 2" run: | - echo $My_VAL \ No newline at end of file + echo $My_VAL # This will print "hello" \ No newline at end of file From 9ed6f38515b54c3c654d9121fd1a8d1dfbe3e9cc Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:28:07 +0100 Subject: [PATCH 22/37] Context example --- .github/workflows/context.yml | 10 ++++++++++ .../templates}/workflow-comand.yml | 0 2 files changed, 10 insertions(+) create mode 100644 .github/workflows/context.yml rename {.github/workflows => github-actions/templates}/workflow-comand.yml (100%) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml new file mode 100644 index 000000000..a03c511f5 --- /dev/null +++ b/.github/workflows/context.yml @@ -0,0 +1,10 @@ +name: Context Example + +on: [push] + +jobs: + my-context: + runs-on: ubuntu-latest + steps: + - name: "My Step" + run: echo "Hello! {{ github.action }}" \ No newline at end of file diff --git a/.github/workflows/workflow-comand.yml b/github-actions/templates/workflow-comand.yml similarity index 100% rename from .github/workflows/workflow-comand.yml rename to github-actions/templates/workflow-comand.yml From 13f44743806b1911f82a6b071bffe8186aa4e425 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:32:58 +0100 Subject: [PATCH 23/37] context test --- .github/workflows/context.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index a03c511f5..fd323af50 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -7,4 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - name: "My Step" - run: echo "Hello! {{ github.action }}" \ No newline at end of file + run: echo "Hello! {{ github.action }}" + env: + MY_ACTION: ${{ github.action }} \ No newline at end of file From de3fe21bb1e6817693d957df54e6dc0bf3d42bef Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:33:53 +0100 Subject: [PATCH 24/37] context test selfhosted --- .github/workflows/context.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index fd323af50..25b4634d6 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -4,7 +4,7 @@ on: [push] jobs: my-context: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: "My Step" run: echo "Hello! {{ github.action }}" From e836fa635d10496e8539fc651a853628b25c018d Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:35:49 +0100 Subject: [PATCH 25/37] my context action --- .github/workflows/context.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index 25b4634d6..960d1600d 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -7,6 +7,6 @@ jobs: runs-on: self-hosted steps: - name: "My Step" - run: echo "Hello! {{ github.action }}" + run: echo "Hello! $MY_ACTION" env: MY_ACTION: ${{ github.action }} \ No newline at end of file From 6748f2c9116f41d09d95bbf058c3c1763434ec80 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:42:00 +0100 Subject: [PATCH 26/37] test with github actor --- .github/workflows/context.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index 960d1600d..d0d77e061 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -7,6 +7,10 @@ jobs: runs-on: self-hosted steps: - name: "My Step" - run: echo "Hello! $MY_ACTION" + run: | + echo "Hello! $MY_ACTION" + echo "Hello! $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 From 511b3bd47c831eac4210092b9d8a8ccd951c4d9c Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:50:58 +0100 Subject: [PATCH 27/37] Dependen job --- .github/workflows/jobs.yml | 25 +++++++++++++++++++ .../templates}/context.yml | 0 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/jobs.yml rename {.github/workflows => github-actions/templates}/context.yml (100%) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml new file mode 100644 index 000000000..3aff96991 --- /dev/null +++ b/.github/workflows/jobs.yml @@ -0,0 +1,25 @@ +name: "Dependen jobs Example" + +on: + push: + branches: + - main + +jobs: + job2: + runs-on: self-hosted + needs: job1 + steps: + - name: "step 2" + run: | + echo $MY_VAL # This will print "hello" + + job1: + runs-on: self-hosted + steps: + - name: "step 1" + run: | + echo "MY_VAL=hello" >> $GITHUB_ENV + env: + MY_VAL: hello + \ 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 From acd3d37afd2e18d519b728adb8cf2bc8fb704a03 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:53:12 +0100 Subject: [PATCH 28/37] without needs --- .github/workflows/jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index 3aff96991..a6afbf5ef 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -8,7 +8,7 @@ on: jobs: job2: runs-on: self-hosted - needs: job1 + #needs: job1 steps: - name: "step 2" run: | From 0b35e0f47a8c54dafafe81cbcbe5e32a5dd7e704 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 14:57:23 +0100 Subject: [PATCH 29/37] asdfa --- .github/workflows/jobs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index a6afbf5ef..4e93d9e22 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -8,11 +8,11 @@ on: jobs: job2: runs-on: self-hosted - #needs: job1 + needs: job1 steps: - name: "step 2" run: | - echo $MY_VAL # This will print "hello" + echo "Say hello $MY_VAL" job1: runs-on: self-hosted From 38b7d28986f9e06769e7b1322f7a7e53fd93ec28 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 16:57:56 +0100 Subject: [PATCH 30/37] test --- .github/workflows/custom_action.yml | 15 +++++++++++++++ .../templates}/jobs.yml | 0 2 files changed, 15 insertions(+) create mode 100644 .github/workflows/custom_action.yml rename {.github/workflows => github-actions/templates}/jobs.yml (100%) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml new file mode 100644 index 000000000..53f8f2ccd --- /dev/null +++ b/.github/workflows/custom_action.yml @@ -0,0 +1,15 @@ +on: [push] + +jobs: + hello_world_job: + runs-on: self-hosted + name: A job to say hello + steps: + - name: Hello world action step + id: hello + uses: goranrad/barsoom-action@v0.0.1 + with: + name: 'Brown' + # Use the output from the `hello` step + - name: Get the output time + run: echo "The time was ${{ steps.hello.outputs.time }}" diff --git a/.github/workflows/jobs.yml b/github-actions/templates/jobs.yml similarity index 100% rename from .github/workflows/jobs.yml rename to github-actions/templates/jobs.yml From fdfc60f3b4e5ee21451a0f9dde6ab80571b961de Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 16:59:02 +0100 Subject: [PATCH 31/37] test --- .github/workflows/custom_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index 53f8f2ccd..7219be2d1 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Hello world action step id: hello - uses: goranrad/barsoom-action@v0.0.1 + uses: goranrad/barsoom@0.0.1 with: name: 'Brown' # Use the output from the `hello` step From 4bbcc1dcb902ec1997af63df08dbe558759d230f Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:07:15 +0100 Subject: [PATCH 32/37] test 02 --- .github/workflows/custom_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index 7219be2d1..0602bc4a0 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Hello world action step id: hello - uses: goranrad/barsoom@0.0.1 + uses: goranrad/barsoom@0.0.2 with: name: 'Brown' # Use the output from the `hello` step From 5f93bb8bf9fdf94b519e878a6b9f536d4f1f2f86 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:13:18 +0100 Subject: [PATCH 33/37] v3 --- .github/workflows/custom_action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index 0602bc4a0..bdbd95ccc 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -9,6 +9,7 @@ jobs: id: hello uses: goranrad/barsoom@0.0.2 with: + name: 'Brown' # Use the output from the `hello` step - name: Get the output time From e1b66685624ebb291eaac767997d8106a364c81b Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:19:17 +0100 Subject: [PATCH 34/37] v3 --- .github/workflows/custom_action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index bdbd95ccc..43f16b09c 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -7,10 +7,9 @@ jobs: steps: - name: Hello world action step id: hello - uses: goranrad/barsoom@0.0.2 + uses: goranrad/barsoom@0.0.3 with: - name: 'Brown' - # Use the output from the `hello` step + # dddhe output sds from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}" From 38cfa84140915329ea2a5182ca8804297e2df2ff Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:22:14 +0100 Subject: [PATCH 35/37] ccddcdcd --- .github/workflows/custom_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index 43f16b09c..21039b4a4 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -10,6 +10,6 @@ jobs: uses: goranrad/barsoom@0.0.3 with: name: 'Brown' - # dddhe output sds from the `hello` step + # sssdddhe output sds from the `hello` step - name: Get the output time run: echo "The time was ${{ steps.hello.outputs.time }}" From c91183ecba90656585f276e5370ae361666d2f8b Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:29:05 +0100 Subject: [PATCH 36/37] sdfdfsdfsdf --- .github/workflows/custom_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index 21039b4a4..b99200847 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Hello world action step id: hello - uses: goranrad/barsoom@0.0.3 + uses: goranrad/barsoom@0.0.5 with: name: 'Brown' # sssdddhe output sds from the `hello` step From 191ca04bda8faadcd4c644a7313a7ecda7a374f4 Mon Sep 17 00:00:00 2001 From: goranrad Date: Mon, 10 Feb 2025 17:30:34 +0100 Subject: [PATCH 37/37] 5 five --- .github/workflows/custom_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_action.yml b/.github/workflows/custom_action.yml index b99200847..e82947ec7 100644 --- a/.github/workflows/custom_action.yml +++ b/.github/workflows/custom_action.yml @@ -2,7 +2,7 @@ on: [push] jobs: hello_world_job: - runs-on: self-hosted + runs-on: ubuntu-latest name: A job to say hello steps: - name: Hello world action step