From 2cd8a2b97f04f9553dc23d6c418d904fcf07830d Mon Sep 17 00:00:00 2001 From: "Michael Oluyombo (NSHD R)" Date: Mon, 15 Sep 2025 16:27:45 +0100 Subject: [PATCH 01/35] Add PostgreSQL Docker workflow and Dockerfile --- .../.github/workflows/postgres-image.yml | 36 ++++++++++++ postgresql-workflow-example/README.md | 57 +++++++++++++++++++ postgresql-workflow-example/docker/Dockerfile | 9 +++ postgresql-workflow-example/package.json | 27 +++++++++ postgresql-workflow-example/src/app.js | 33 +++++++++++ 5 files changed, 162 insertions(+) create mode 100644 postgresql-workflow-example/.github/workflows/postgres-image.yml create mode 100644 postgresql-workflow-example/README.md create mode 100644 postgresql-workflow-example/docker/Dockerfile create mode 100644 postgresql-workflow-example/package.json create mode 100644 postgresql-workflow-example/src/app.js diff --git a/postgresql-workflow-example/.github/workflows/postgres-image.yml b/postgresql-workflow-example/.github/workflows/postgres-image.yml new file mode 100644 index 000000000..cf39e1bfb --- /dev/null +++ b/postgresql-workflow-example/.github/workflows/postgres-image.yml @@ -0,0 +1,36 @@ +name: Build and Push PostgreSQL Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + # Ensure that DOCKER_USERNAME and DOCKER_PASSWORD are set in your repository's secrets at + # https://github.com///settings/secrets/actions + + - name: Build PostgreSQL Docker image + uses: docker/build-push-action@v2 + with: + context: ./docker + file: ./docker/Dockerfile + push: true + tags: your-dockerhub-username/postgres-image:latest + + - name: Logout from Docker Hub + run: docker logout \ No newline at end of file diff --git a/postgresql-workflow-example/README.md b/postgresql-workflow-example/README.md new file mode 100644 index 000000000..c06985253 --- /dev/null +++ b/postgresql-workflow-example/README.md @@ -0,0 +1,57 @@ +# PostgreSQL Workflow Example + +This project demonstrates how to build and push a PostgreSQL Docker image using GitHub Actions. It includes a Dockerfile for creating the PostgreSQL image and a GitHub Actions workflow for automating the build and push process. + +## Project Structure + +``` +postgresql-workflow-example +├── .github +│ └── workflows +│ └── postgres-image.yml # GitHub Actions workflow for building and pushing the Docker image +├── docker +│ └── Dockerfile # Dockerfile for PostgreSQL image +├── src +│ └── app.js # Main application file for connecting to the PostgreSQL database +├── package.json # npm configuration file +└── README.md # Project documentation +``` + +## Getting Started + +To get started with this project, follow these steps: + +1. **Clone the repository**: + ```bash + git clone + cd postgresql-workflow-example + ``` + +2. **Build the Docker image**: + Navigate to the `docker` directory and build the image using the Dockerfile: + ```bash + cd docker + docker build -t your-postgres-image-name . + ``` + +3. **Run the Docker container**: + After building the image, you can run it with: + ```bash + docker run --name your-container-name -e POSTGRES_PASSWORD=yourpassword -d your-postgres-image-name + ``` + +## GitHub Actions Workflow + +The GitHub Actions workflow defined in `.github/workflows/postgres-image.yml` automates the process of building and pushing the Docker image to a container registry whenever changes are pushed to the main branch. + +## Usage + +You can connect to the PostgreSQL database using the credentials specified in the Docker run command. The main application logic can be found in `src/app.js`, where you can implement your database operations. + +## Contributing + +Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes. + +## License + +This project is licensed under the MIT License. See the LICENSE file for more details. \ No newline at end of file diff --git a/postgresql-workflow-example/docker/Dockerfile b/postgresql-workflow-example/docker/Dockerfile new file mode 100644 index 000000000..c135da3d6 --- /dev/null +++ b/postgresql-workflow-example/docker/Dockerfile @@ -0,0 +1,9 @@ +FROM postgres:latest + +ENV POSTGRES_USER=myuser +ENV POSTGRES_PASSWORD=mypassword +ENV POSTGRES_DB=mydatabase + +COPY init.sql /docker-entrypoint-initdb.d/ + +EXPOSE 5432 \ No newline at end of file diff --git a/postgresql-workflow-example/package.json b/postgresql-workflow-example/package.json new file mode 100644 index 000000000..00f2de4de --- /dev/null +++ b/postgresql-workflow-example/package.json @@ -0,0 +1,27 @@ +{ + "name": "postgresql-workflow-example", + "version": "1.0.0", + "description": "A project to demonstrate building and pushing a PostgreSQL Docker image using GitHub Actions.", + "main": "src/app.js", + "scripts": { + "start": "node src/app.js", + "test": "echo \"No tests specified\" && exit 0" + }, + "dependencies": { + "pg": "^8.7.1" + }, + "devDependencies": { + "nodemon": "^2.0.15" + }, + "repository": { + "type": "git", + "url": "https://github.com/yourusername/postgresql-workflow-example.git" + }, + "keywords": [ + "postgresql", + "docker", + "github-actions" + ], + "author": "Your Name", + "license": "MIT" +} \ No newline at end of file diff --git a/postgresql-workflow-example/src/app.js b/postgresql-workflow-example/src/app.js new file mode 100644 index 000000000..e94ab239c --- /dev/null +++ b/postgresql-workflow-example/src/app.js @@ -0,0 +1,33 @@ +const express = require('express'); +const { Pool } = require('pg'); + +const app = express(); +const port = process.env.PORT || 3000; + +// PostgreSQL connection configuration +const pool = new Pool({ + user: process.env.DB_USER, + host: process.env.DB_HOST, + database: process.env.DB_NAME, + password: process.env.DB_PASSWORD, + port: process.env.DB_PORT, +}); + +// Middleware to parse JSON requests +app.use(express.json()); + +// Example route to get data from the database +app.get('/data', async (req, res) => { + try { + const result = await pool.query('SELECT * FROM your_table_name'); + res.status(200).json(result.rows); + } catch (err) { + console.error(err); + res.status(500).send('Server error'); + } +}); + +// Start the server +app.listen(port, () => { + console.log(`Server is running on port ${port}`); +}); \ No newline at end of file From 3884f1d8ce157d1f9ab59167f9d263a9ff333623 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:46:58 +0100 Subject: [PATCH 02/35] Create greetings.yml --- .github/workflows/greetings.yml | 17 +++++++++++++++++ 1 file changed, 17 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..996da6bbd --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,17 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + # https://github.com/actions/first-interaction + - 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 3bc1ace4f3cf461ea967358bbfc56623d7376228 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:21:49 +0100 Subject: [PATCH 03/35] Create PostgreSQL image Create PostgreSQL image --- .github/workflows/PostgreSQL image | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/PostgreSQL image diff --git a/.github/workflows/PostgreSQL image b/.github/workflows/PostgreSQL image new file mode 100644 index 000000000..29e5b5d0f --- /dev/null +++ b/.github/workflows/PostgreSQL image @@ -0,0 +1,34 @@ +# filepath: .github/workflows/postgres-image.yml +name: PostgreSQL Docker Workflow + +on: + push: + paths: + - 'docker/**' + - '.github/workflows/postgres-image.yml' + +jobs: + postgres: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: myuser + POSTGRES_PASSWORD: mypassword + POSTGRES_DB: mydatabase + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - name: Wait for PostgreSQL to be ready + run: | + for i in {1..30}; do + pg_isready -h localhost -p 5432 -U myuser && break + sleep 2 + done From 4cce865bfbdbd2032d05b22122b167c3963e1857 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:15:36 +0100 Subject: [PATCH 04/35] move these to save them for later --- .github/workflows/greetings.yml | 17 ----------------- .../templates}/PostgreSQL image | 0 2 files changed, 17 deletions(-) delete mode 100644 .github/workflows/greetings.yml rename {.github/workflows => github-actions/templates}/PostgreSQL image (100%) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml deleted file mode 100644 index 996da6bbd..000000000 --- a/.github/workflows/greetings.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Greetings - -on: [pull_request_target, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - # https://github.com/actions/first-interaction - - 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/PostgreSQL image b/github-actions/templates/PostgreSQL image similarity index 100% rename from .github/workflows/PostgreSQL image rename to github-actions/templates/PostgreSQL image From aeb3c7c808134dd018c59ef85a76636fcaeeca7c Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:54:50 +0100 Subject: [PATCH 05/35] add schedule workflow --- .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 ec5b557a893dab594932c1f8c2c91d0e5703d211 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 16 Sep 2025 14:08:30 +0100 Subject: [PATCH 06/35] 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 f9a92cda927828f5fac7a44534d47ec63fd62a90 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 10:26:52 +0000 Subject: [PATCH 07/35] manual workflow --- .github/workflows/manual.yml | 32 ++++++++++++++++++++++++++++++++ github-actions/mydata2 | 1 + 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/manual.yml create mode 100644 github-actions/mydata2 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/mydata2 b/github-actions/mydata2 new file mode 100644 index 000000000..1bea4a2ee --- /dev/null +++ b/github-actions/mydata2 @@ -0,0 +1 @@ +SGVsbG8gTWFycw== \ No newline at end of file From f76f9e630d2122a72e3409ecf39de178b39d1c75 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:35:08 +0000 Subject: [PATCH 08/35] add webhook --- .github/workflows/custom-action.yml | 15 -------------- .github/workflows/manual.yml | 32 ----------------------------- .github/workflows/multi-event.yml | 19 ----------------- .github/workflows/schedule.yml | 10 --------- .github/workflows/webhook.yml | 15 ++++++++++++++ 5 files changed, 15 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/custom-action.yml delete mode 100644 .github/workflows/manual.yml delete mode 100644 .github/workflows/multi-event.yml delete mode 100644 .github/workflows/schedule.yml create mode 100644 .github/workflows/webhook.yml diff --git a/.github/workflows/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/manual.yml b/.github/workflows/manual.yml deleted file mode 100644 index 081adf3a6..000000000 --- a/.github/workflows/manual.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Manual Trigger with Params - -on: - workflow_dispatch: - inputs: - name: - description: 'Name of the person to greet' - required: true - type: string - greeting: - description: 'Type of greeting' - required: true - type: string - data: - description: 'Base64 encoded content of a file' - required: false - type: string - -jobs: - greet: - runs-on: ubuntu-latest - steps: - - name: Decode File Content - run: | - echo "${{ inputs.data }}" | base64 --decode > ./decoded_file.txt - - name: Display Greeting - run: | - echo "${{ inputs.greeting }}, ${{ inputs.name }}!" - - name: Display File Content - run: | - echo "Contents of the file:" - cat ./decoded_file.txt \ No newline at end of file diff --git a/.github/workflows/multi-event.yml b/.github/workflows/multi-event.yml deleted file mode 100644 index a3275be38..000000000 --- a/.github/workflows/multi-event.yml +++ /dev/null @@ -1,19 +0,0 @@ -on: - push: - branches: - - main - - dev - pull_request: - branches: - - main - -jobs: - hello_world: - runs-on: ubuntu-latest - steps: - - name: "Echo Basic Information" - run: | - echo "REF: $GITHUB_REF" - echo "Job ID: $GITHUB_JOB" - echo "Action: $GITHUB_ACTION" - echo "Actor: $GITHUB_ACTOR" \ No newline at end of file diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml deleted file mode 100644 index 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)" 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 3069aa236b5733cecc9ca616072dfdbbe0cf12df Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:37:51 +0000 Subject: [PATCH 09/35] does this trigger? --- github-actions/Readme.me | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/Readme.me b/github-actions/Readme.me index 9be613aad..1a74cc214 100644 --- a/github-actions/Readme.me +++ b/github-actions/Readme.me @@ -6,7 +6,7 @@ echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json ``` ## Webhook Event - + ```sh curl -X POST \ -H "Accept: application/vnd.github+json" \ From 0ca29b3276e7a7c90a6cecba4769a991e1ad4678 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:42:21 +0000 Subject: [PATCH 10/35] custom webhook --- .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..aeab04526 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 42aa031137e5b3f84e950ff2e13e700ea7e3e4fc Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:44:10 +0000 Subject: [PATCH 11/35] sadsdasda --- .github/workflows/webhook.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index aeab04526..56a3126cf 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -5,6 +5,7 @@ on: types: - custom webhook + jobs: respond-to-dispatch: runs-on: ubuntu-latest From 6dc8f7073073612b1d2a12087c5c741b72042026 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:50:25 +0000 Subject: [PATCH 12/35] fix this 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 56a3126cf..14c1642c3 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -5,12 +5,12 @@ on: types: - custom 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 2b94f66666e4bdd40e892b95527cce6b8ec1f462 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:51:57 +0000 Subject: [PATCH 13/35] fix syntax --- .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 14c1642c3..5c07921a4 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -3,7 +3,7 @@ name: "Webhook Event example" on: repository_dispatch: types: - - custom webhook + - webhook jobs: From 4c7a9d9ffdb340099563b217a762534188799176 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:21:35 +0100 Subject: [PATCH 14/35] try again x2 --- .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 5c07921a4..299974a37 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -13,4 +13,4 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - name: Run a script - run: echo "Event of type: $GITHUB_EVENT_NAME" + run: echo "Event of type: $GITHUB_EVENT_NAME" From a933c5cc659c62a1d3b16849c027f163dffd3b65 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:27:48 +0100 Subject: [PATCH 15/35] try again this time --- .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 299974a37..72127ee03 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -13,4 +13,4 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - name: Run a script - run: echo "Event of type: $GITHUB_EVENT_NAME" + run: echo "Event of type:$GITHUB_EVENT_NAME" From 627e7ab9e5e164d8fbe86b37c09cb0130ad65991 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:28:24 +0100 Subject: [PATCH 16/35] try now --- .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 72127ee03..b14f38ecb 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -13,4 +13,4 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - name: Run a script - run: echo "Event of type:$GITHUB_EVENT_NAME" + run: echo "Event of type:$GITHUB_EVENT_NAME" From f8a7030eef5a80c76254b98f034d6c673cfce8d2 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:45:36 +0100 Subject: [PATCH 17/35] 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 4ea3192b244501a4a39a836230fd733cb7b44724 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:48:10 +0100 Subject: [PATCH 18/35] conditional --- .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..40f41939c 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 == 'MickeyGithubL/Github-ExamProCo' runs-on: ubuntu-latest steps: - name: "Hello World" From d59b1d1567957bf30f1cc966291e06f4a695617e Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:25:06 +0100 Subject: [PATCH 19/35] expression function example --- .github/workflows/conditional.yml | 14 -------- .github/workflows/expression-functions.yml | 37 ++++++++++++++++++++++ .github/workflows/webhook.yml | 16 ---------- 3 files changed, 37 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 40f41939c..000000000 --- a/.github/workflows/conditional.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: example-workflow -on: [push] -jobs: - hello-world: - if: github.repository == 'MickeyGithubL/Github-ExamProCo' - 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 diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml deleted file mode 100644 index b14f38ecb..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: echo "Event of type:$GITHUB_EVENT_NAME" From 88df31b1839046d9821c9445b8ea253d95816a5f Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:29:56 +0100 Subject: [PATCH 20/35] xxxxdddfff --- .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 e213a386b..ad3cf229d 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 6da87a107a6145bcee398b6d531628cb7526585d Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:38:51 +0100 Subject: [PATCH 21/35] dfbdfgsnthdgj --- .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 ad3cf229d..b4f48a6a4 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -4,6 +4,8 @@ on: push: branches: - main + issues: + types: [opened, labelled] jobs: expression-functions: @@ -22,7 +24,7 @@ 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) }}" - name: Parse JSON string From 474ce44376fa10b9aabef7bd0dc2e481b7d6fb16 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:42:04 +0100 Subject: [PATCH 22/35] try and fix expressions --- .github/workflows/expression-functions.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index b4f48a6a4..4c9d09117 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -4,8 +4,6 @@ on: push: branches: - main - issues: - types: [opened, labelled] jobs: expression-functions: @@ -22,9 +20,6 @@ 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) }}" - name: Parse JSON string From ccc16acdbc49af25f9bc2dc1f68c95a3b54c7b1d Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:08:48 +0100 Subject: [PATCH 23/35] expression function --- .github/workflows/expression-functions.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 4c9d09117..91f2b310f 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -21,12 +21,14 @@ jobs: - 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) }}" + 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: "success:" - name: The job has failed - if: ${{ failure() }} \ No newline at end of file + if: ${{ failure() }} + run: echo: "failure!" \ No newline at end of file From 4f567109c52eb5b6e360393eabc91e486d860183 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:10:12 +0100 Subject: [PATCH 24/35] try expression again --- .github/workflows/expression-functions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/expression-functions.yml b/.github/workflows/expression-functions.yml index 91f2b310f..f0c744deb 100644 --- a/.github/workflows/expression-functions.yml +++ b/.github/workflows/expression-functions.yml @@ -21,11 +21,11 @@ jobs: - 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) }}" + 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: "success:" From a600fa82502ab9d5cd447d80f49846a160e06a32 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:07:27 +0100 Subject: [PATCH 25/35] runners for macos and windows --- .github/workflows/runner-macos.yml | 30 ++++++++++++++++++++++ .github/workflows/runner-windows.yml | 38 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/runner-macos.yml create mode 100644 .github/workflows/runner-windows.yml 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 65b184848387dfdb35ee777c68e1eb559ca3ff1a Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:06:17 +0000 Subject: [PATCH 26/35] commit self hosted runner --- .github/workflows/runner-self-hosted.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/runner-self-hosted.yml 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 ca0f5f414418bf4379724d2f470fea7be0fc5078 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:09:54 +0000 Subject: [PATCH 27/35] workflow commands example --- .github/workflows/workflow-command.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/workflow-command.yml diff --git a/.github/workflows/workflow-command.yml b/.github/workflows/workflow-command.yml new file mode 100644 index 000000000..6fb5a49a9 --- /dev/null +++ b/.github/workflows/workflow-command.yml @@ -0,0 +1,15 @@ +name: "Workflow Commands" + +on: + push: + branches: [ main ] + +jobs: + my-job: + runs-on: ubuntu-latest + steps: + - name: "group logging" + run: | + echo "::group::My Group Message" + echo "Msg1" + echo "::endgroup::" \ No newline at end of file From d0ce29c28dc58780982f6fad671dbd8887b5009e Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:12:36 +0000 Subject: [PATCH 28/35] Add workflow commands workflow file --- .github/workflows/expression-functions.yml | 34 ------------------- .github/workflows/runner-macos.yml | 30 ----------------- .github/workflows/runner-self-hosted.yml | 17 ---------- .github/workflows/runner-windows.yml | 38 ---------------------- 4 files changed, 119 deletions(-) delete mode 100644 .github/workflows/expression-functions.yml delete mode 100644 .github/workflows/runner-macos.yml delete mode 100644 .github/workflows/runner-self-hosted.yml delete 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 f0c744deb..000000000 --- a/.github/workflows/expression-functions.yml +++ /dev/null @@ -1,34 +0,0 @@ -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: 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: "success:" - - name: The job has failed - if: ${{ failure() }} - run: echo: "failure!" \ No newline at end of file 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-self-hosted.yml b/.github/workflows/runner-self-hosted.yml deleted file mode 100644 index 23bb12e71..000000000 --- a/.github/workflows/runner-self-hosted.yml +++ /dev/null @@ -1,17 +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/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 7a82432ced9d6141b0a8408172b959253dd4d8a6 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:04:22 +0000 Subject: [PATCH 29/35] env var in other steps --- .github/workflows/workflow-command.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow-command.yml b/.github/workflows/workflow-command.yml index 6fb5a49a9..c8c679ef4 100644 --- a/.github/workflows/workflow-command.yml +++ b/.github/workflows/workflow-command.yml @@ -1,8 +1,6 @@ name: "Workflow Commands" -on: - push: - branches: [ main ] +on: ['push'] jobs: my-job: @@ -12,4 +10,11 @@ jobs: run: | echo "::group::My Group Message" echo "Msg1" - echo "::endgroup::" \ No newline at end of file + echo "Msg2" + echo "::endgroup::" + - name: "step 1" + run: | + echo "MY_VAL=hello" >> $GITHUB_ENV" + - name: "step 2" + run: | + echo $MY_VAL" \ No newline at end of file From 408095aeaa4ffcafbd1ffc5d49ea4a4bbae1312e Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:09:10 +0000 Subject: [PATCH 30/35] Fix shell quoting in workflow-command.yml steps --- .github/workflows/workflow-command.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow-command.yml b/.github/workflows/workflow-command.yml index c8c679ef4..7d9824c27 100644 --- a/.github/workflows/workflow-command.yml +++ b/.github/workflows/workflow-command.yml @@ -1,6 +1,8 @@ name: "Workflow Commands" -on: ['push'] +on: + push: + branches: [ main ] jobs: my-job: @@ -14,7 +16,7 @@ jobs: echo "::endgroup::" - name: "step 1" run: | - echo "MY_VAL=hello" >> $GITHUB_ENV" + echo "MY_VAL=hello" >> "$GITHUB_ENV" - name: "step 2" run: | - echo $MY_VAL" \ No newline at end of file + echo "$MY_VAL" \ No newline at end of file From d4e58770988bde80718dbc743ab23e781dca4025 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:33:58 +0000 Subject: [PATCH 31/35] attempt context --- .github/workflows/context.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 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..be9382615 --- /dev/null +++ b/.github/workflows/context.yml @@ -0,0 +1,22 @@ +name: Context Examples + +on: ['push'] +jobs: + context-job: + runs-on: ubuntu-latest + env: + MY_ACTION: ${{ github.action }} + steps: + - name: "My Step" + run: echo "Hello! $MY_ACTION" + - name: Show Runner Context + run: | + echo "$RUNNER_CONTEXT" + - name: Show Job Context + run: | + echo "Job Context:" + echo "$JOB_CONTEXT" + - name: Show Step Context + run: | + echo "Step Context:" + echo "$STEP_CONTEXT" \ No newline at end of file From dbea1fdffc0b9a46d39cc8854392f9a4b6f6d0c0 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:28:17 +0000 Subject: [PATCH 32/35] Fix run command formatting in context.yml --- .github/workflows/context.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index be9382615..2c3966b71 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -1,22 +1,18 @@ name: Context Examples -on: ['push'] +on: + push: + branches: [ main ] + jobs: context-job: runs-on: ubuntu-latest - env: - MY_ACTION: ${{ github.action }} steps: - name: "My Step" - run: echo "Hello! $MY_ACTION" - - name: Show Runner Context - run: | - echo "$RUNNER_CONTEXT" - - name: Show Job Context - run: | - echo "Job Context:" - echo "$JOB_CONTEXT" - - name: Show Step Context run: | - echo "Step Context:" - echo "$STEP_CONTEXT" \ No newline at end of file + echo "Action! $MY_ACTION" + echo "Actor! $MY_ACTOR" + env: + MY_ACTION: ${{ github.action }} + MY_ACTOR: ${{ github.actor }} + \ No newline at end of file From c0dccff83b119ea8daafd6b567ccb1faab7e3106 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:43:11 +0000 Subject: [PATCH 33/35] jobs workflow example --- .github/workflows/jobs.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/jobs.yml diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml new file mode 100644 index 000000000..f46f6f3ca --- /dev/null +++ b/.github/workflows/jobs.yml @@ -0,0 +1,22 @@ +name: "Dep Jobs Example" + +on: + push: + branches: [ main ] +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: "Job 1 Step" + run: echo "Hello" + job2: + runs-on: ubuntu-latest + needs: job1 + steps: + - name: "Job 2 Step" + run: echo "World" + - name: "Show Job 1 Output" + run: echo "Job 1 completed successfully!" + if: ${{ needs.job1.result == 'success' }} + - name: "Failing Step in Job 2" + run: exit 1 \ No newline at end of file From 0e38f27b6afabb9b9dfae327c0a1e59204d85199 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:44:52 +0000 Subject: [PATCH 34/35] Fix and improve jobs.yml workflow --- .github/workflows/jobs.yml | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index f46f6f3ca..6c677a0cb 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -1,22 +1,31 @@ -name: "Dep Jobs Example" +name: "Dependent Jobs Example" on: push: branches: [ main ] + workflow_dispatch: # Allow manual triggering + jobs: - job1: - runs-on: ubuntu-latest - steps: - - name: "Job 1 Step" - run: echo "Hello" - job2: - runs-on: ubuntu-latest - needs: job1 - steps: - - name: "Job 2 Step" - run: echo "World" - - name: "Show Job 1 Output" - run: echo "Job 1 completed successfully!" - if: ${{ needs.job1.result == 'success' }} - - name: "Failing Step in Job 2" - run: exit 1 \ No newline at end of file + job1: + runs-on: ubuntu-latest + steps: + - name: "Job 1 Step" + run: | + echo "Hello from Job 1" + echo "status=success" >> $GITHUB_OUTPUT + + job2: + runs-on: ubuntu-latest + needs: job1 + steps: + - name: "Job 2 Step" + run: echo "World from Job 2" + + - name: "Show Job 1 Output" + if: ${{ needs.job1.result == 'success' }} + run: echo "Job 1 completed successfully!" + + - name: "Continue with Job 2" + run: | + echo "Performing Job 2 tasks..." + echo "All tasks completed successfully!" \ No newline at end of file From 7716d9d8a8aaf06f6f6690c01842dd6e5a6054b7 Mon Sep 17 00:00:00 2001 From: MickeyGithubL <91271771+MickeyGithubL@users.noreply.github.com> Date: Tue, 28 Oct 2025 13:51:18 +0000 Subject: [PATCH 35/35] try again --- .github/workflows/jobs.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index 6c677a0cb..c3b0e8ca1 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -6,26 +6,15 @@ on: workflow_dispatch: # Allow manual triggering jobs: - job1: + job2: runs-on: ubuntu-latest steps: - - name: "Job 1 Step" + - name: StepA" run: | - echo "Hello from Job 1" - echo "status=success" >> $GITHUB_OUTPUT - - job2: + echo "World" + job1: runs-on: ubuntu-latest - needs: job1 steps: - - name: "Job 2 Step" - run: echo "World from Job 2" - - - name: "Show Job 1 Output" - if: ${{ needs.job1.result == 'success' }} - run: echo "Job 1 completed successfully!" - - - name: "Continue with Job 2" - run: | - echo "Performing Job 2 tasks..." - echo "All tasks completed successfully!" \ No newline at end of file + - name: StepB + run: + echo "Hello" \ No newline at end of file