From 250c1522e27953554fc5432cca0bea45285b582d Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 09:50:48 -0400 Subject: [PATCH 01/18] Add push trigger for GitHub Actions workflow --- .github/workflows/github-actions-demo.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index e8540e80..1028945d 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -2,7 +2,11 @@ name: 01-1. GitHub Actions Demo on: workflow_dispatch: workflow_call: - + push: + branches: + - main + paths: + - 'labs/**' jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest From a5f0bb9dc00e03f69d4145869502e17cea693d8e Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 09:58:31 -0400 Subject: [PATCH 02/18] Add Hello World action to GitHub workflow --- .github/workflows/github-actions-demo.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 1028945d..ff52146d 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -24,3 +24,15 @@ jobs: - run: echo "🍏 This job's status is ${{ job.status }}." - name: Adding markdown run: echo "### Hello world! :rocket:" >> "$GITHUB_STEP_SUMMARY" + # This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action + - name: Hello world + uses: actions/hello-world-javascript-action@main + with: + who-to-greet: "Mona the Octocat" + id: hello + # This step prints an output (time) from the previous step's action. + - name: Echo the greeting's time + run: echo 'The time was ${{ steps.hello.outputs.time }}.' + + + From c1b27292bef6651e61c5df85989880f491cf0877 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 10:02:47 -0400 Subject: [PATCH 03/18] Refactor GitHub Actions workflow configuration --- .github/workflows/github-actions-demo.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index ff52146d..1b0e1d45 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -3,10 +3,9 @@ on: workflow_dispatch: workflow_call: push: - branches: - - main - paths: - - 'labs/**' + branches: + - main + jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest @@ -24,7 +23,7 @@ jobs: - run: echo "🍏 This job's status is ${{ job.status }}." - name: Adding markdown run: echo "### Hello world! :rocket:" >> "$GITHUB_STEP_SUMMARY" - # This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action + # This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action - name: Hello world uses: actions/hello-world-javascript-action@main with: @@ -33,6 +32,3 @@ jobs: # This step prints an output (time) from the previous step's action. - name: Echo the greeting's time run: echo 'The time was ${{ steps.hello.outputs.time }}.' - - - From 3ad1fcd1cfd85005a763e6d4a3609193f59bfd38 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:23:06 -0400 Subject: [PATCH 04/18] Add job dependencies for CI workflow --- .github/workflows/job-dependencies.yml | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/job-dependencies.yml b/.github/workflows/job-dependencies.yml index e773fe04..58723646 100644 --- a/.github/workflows/job-dependencies.yml +++ b/.github/workflows/job-dependencies.yml @@ -31,3 +31,38 @@ jobs: needs: [fanout1, fanout2] steps: - run: echo "This job will run after fanout1 and fanout2 have finished." + + build: + runs-on: windows-latest + steps: + - run: echo "This job will be run in parallel with the initial job." + test: + runs-on: ubuntu-latest + needs: build + steps: + - run: echo "This job will be run after the build job." + ring01: + runs-on: ubuntu-latest + needs: test + steps: + - run: echo "This job will be run after the test job." + ring02: + runs-on: macos-latest + needs: test + steps: + - run: echo "This job will be run after the test job." + ring03: + runs-on: ubuntu-latest + needs: test + steps: + - run: echo "This job will be run after the test job." + ring04: + runs-on: ubuntu-latest + needs: [ring01,ring02,ring03] + steps: + - run: echo "This job will be run after the ring01,ring02,ring03 jobs." + prod: + runs-on: ubuntu-latest + needs: [ring04] + steps: + - run: echo "This job will be run after the ring04 job." From cbe2f6d4fb5dfa4ef6b657008216a247a0a57c74 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:33:43 -0400 Subject: [PATCH 05/18] Modify job dependencies and build configuration Updated job dependencies to trigger on push to main and changed build job to run on Ubuntu with a matrix strategy. --- .github/workflows/job-dependencies.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/job-dependencies.yml b/.github/workflows/job-dependencies.yml index 58723646..f5828b01 100644 --- a/.github/workflows/job-dependencies.yml +++ b/.github/workflows/job-dependencies.yml @@ -2,9 +2,9 @@ name: 02-2. Dependencies on: workflow_dispatch: - # push: - # branches: - # - main + push: + branches: + - main jobs: initial: @@ -33,9 +33,12 @@ jobs: - run: echo "This job will run after fanout1 and fanout2 have finished." build: - runs-on: windows-latest + runs-on: ubuntu-latest + strategy: + matrix: + configuration: [debug, release] steps: - - run: echo "This job will be run in parallel with the initial job." + - run: echo "This job builds the cofiguration ${{ matrix.configuration }}." test: runs-on: ubuntu-latest needs: build From c4f61bcc96b3037ce95024c3eca4720590175414 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:47:23 -0400 Subject: [PATCH 06/18] Enable triggers and add job for using secrets Updated workflow to enable push and pull request triggers for the main branch and added a job to use secrets. --- .github/workflows/environments-secrets.yml | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/environments-secrets.yml b/.github/workflows/environments-secrets.yml index 2b128265..f2e06ae5 100644 --- a/.github/workflows/environments-secrets.yml +++ b/.github/workflows/environments-secrets.yml @@ -1,10 +1,10 @@ name: 03-1. Environments and Secrets on: - # push: - # branches: [main] - # pull_request: - # branches: [main] + push: + branches: [main] + pull_request: + branches: [main] workflow_dispatch: # Limit the permissions of the GITHUB_TOKEN @@ -19,6 +19,25 @@ env: DEV_URL: 'https://docs.github.com/en/developers' jobs: + + use-secrets: + name: Use secrets + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + steps: + - name: Hello world action with secrets + uses: actions/hello-world-javascript-action@main + with: # Set the secret as an input + who-to-greet: ${{ secrets.MY_REPO_SECRET }} + env: # Or as an environment variable + super_secret: ${{ secrets.MY_REPO_SECRET }} + - name: Echo secret is redacted in the logs + run: | + echo Env secret is ${{ secrets.MY_REPO_SECRET }} + echo Warning: GitHub automatically redacts secrets printed to the log, + echo but you should avoid printing secrets to the log intentionally. + echo ${{ secrets.MY_REPO_SECRET }} | sed 's/./& /g' + use-environment-dev: name: Use DEV environment runs-on: ubuntu-latest From 590247fc99e1d60b2dcbae981e63693175215a89 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:52:38 -0400 Subject: [PATCH 07/18] Add UAT environment to GitHub Actions workflow --- .github/workflows/environments-secrets.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/environments-secrets.yml b/.github/workflows/environments-secrets.yml index f2e06ae5..77c6df61 100644 --- a/.github/workflows/environments-secrets.yml +++ b/.github/workflows/environments-secrets.yml @@ -91,12 +91,30 @@ jobs: echo Org secret is ${{ secrets.MY_ORG_SECRET }} echo Env secret is not accessible ${{ secrets.MY_ENV_SECRET }} + + use-environment-uat: + name: Use UAT environment + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + needs: use-environment-test + + environment: + name: UAT + url: 'https://uat.github.com' + + steps: + - name: Step that uses the UAT environment + run: echo "Deployment to UAT..." + env: + env_secret: ${{ secrets.MY_ENV_SECRET }} + + use-environment-prod: name: Use PROD environment runs-on: ubuntu-latest #if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - needs: use-environment-test + needs: use-environment-uat environment: name: PROD From c027ddce1f7d46911fb19d964905f5d8fc58f174 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:53:35 -0400 Subject: [PATCH 08/18] Change trigger from workflow_dispatch to workflow_call --- .github/workflows/job-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/job-dependencies.yml b/.github/workflows/job-dependencies.yml index f5828b01..23c46d32 100644 --- a/.github/workflows/job-dependencies.yml +++ b/.github/workflows/job-dependencies.yml @@ -1,7 +1,7 @@ name: 02-2. Dependencies on: - workflow_dispatch: + workflow_call: push: branches: - main From e8ffb1d5ae801b5555ea0b81736ce13fe2f206c6 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:57:28 -0400 Subject: [PATCH 09/18] Add push trigger and new dependency job to workflow --- .github/workflows/reusable-workflow-template.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-workflow-template.yml b/.github/workflows/reusable-workflow-template.yml index 33c7858e..8bf282ae 100644 --- a/.github/workflows/reusable-workflow-template.yml +++ b/.github/workflows/reusable-workflow-template.yml @@ -1,7 +1,9 @@ name: 04-1. Call Reusable Workflow Templates -on: - [workflow_dispatch] +on: + push: + branches: [main] + workflow_dispatch: jobs: call_greet_everyone_workflow_job: @@ -15,3 +17,7 @@ jobs: call_demo_workflow_job: needs: call_greet_everyone_workflow_job uses: githubabcs/gh-abcs-actions/.github/workflows/github-actions-demo.yml@main + + call_dependencies_workflow_job: + needs: call_reusable_workflow_job + uses: /gh-abcs-actions/.github/workflows/job-dependencies.yml@main From 6d27d8f1f13fa1775d4cbe0b61feb7abc9ca8371 Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 09:21:32 -0400 Subject: [PATCH 10/18] Applying a label to an issue --- .github/workflows/github-script.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/github-script.yml b/.github/workflows/github-script.yml index 230ad303..298d8fb4 100644 --- a/.github/workflows/github-script.yml +++ b/.github/workflows/github-script.yml @@ -21,4 +21,16 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, body: '👋 Thank you! We appreciate your contribution to this project.' + }) + apply-label: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Training'] }) \ No newline at end of file From 9ede12c25aafb754a70f4cfa851bd166f6726552 Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 09:50:43 -0400 Subject: [PATCH 11/18] Using a composite action --- .../actions/hello-world-composite-action/action.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/hello-world-composite-action/action.yml b/.github/actions/hello-world-composite-action/action.yml index 18611d5d..12753942 100644 --- a/.github/actions/hello-world-composite-action/action.yml +++ b/.github/actions/hello-world-composite-action/action.yml @@ -18,4 +18,12 @@ runs: run: echo "random-id=$(echo $RANDOM)" >> $GITHUB_OUTPUT shell: bash - run: echo "${{ github.action_path }}" >> $GITHUB_PATH - shell: bash + shell: bash + - name: Hello world + uses: actions/hello-world-javascript-action@main + with: + who-to-greet: "${{ inputs.who-to-greet }}" + id: hello + - name: Echo the greeting's time + run: echo 'The time was ${{ steps.hello.outputs.time }}.' + shell: bash From a94b7afe1c17c50a9a8343a7dfdd422a23e52f89 Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 09:54:25 -0400 Subject: [PATCH 12/18] Added Job 2 and running on pull request events --- .github/workflows/hello-world-composite.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hello-world-composite.yml b/.github/workflows/hello-world-composite.yml index 989d1f8c..0c045402 100644 --- a/.github/workflows/hello-world-composite.yml +++ b/.github/workflows/hello-world-composite.yml @@ -1,7 +1,9 @@ name: 05-2. Hello World Composite -on: - [workflow_dispatch] +on: + pull_request: + branches: [main] + workflow_dispatch: jobs: hello_world_job1: @@ -14,3 +16,15 @@ jobs: who-to-greet: 'Hello from GH ABCs' - run: echo random-number ${{ steps.hello-world.outputs.random-number }} shell: bash + + hello_world_job2: + runs-on: ubuntu-latest + name: A job2 to say hello + steps: + - uses: actions/checkout@v4 + - id: hello-world + uses: ./.github/actions/hello-world-composite-action + with: + who-to-greet: 'Mona the Octocat from composite action' + - run: echo random-number from composite action ${{ steps.hello-world.outputs.random-number }} + shell: bash From 31a458febbcefedb2d1d2c26c04105afa687be56 Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 10:12:18 -0400 Subject: [PATCH 13/18] Changed the issue title --- .github/workflows/use-custom-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/use-custom-actions.yml b/.github/workflows/use-custom-actions.yml index 55beb2bf..26f0d08a 100644 --- a/.github/workflows/use-custom-actions.yml +++ b/.github/workflows/use-custom-actions.yml @@ -32,7 +32,7 @@ jobs: with: repo-token: ${{secrets.GITHUB_TOKEN}} joke: ${{steps.jokes.outputs.joke-output}} - issue-title: "A joke for you from ${{ github.actor }}" + issue-title: "A joke for you from custom actions workflow" docker-custom-actions: runs-on: ubuntu-latest From 24798e048dc01292ee3ad32b2bc841e631ae3f46 Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 11:25:25 -0400 Subject: [PATCH 14/18] Updating CI workflow --- .github/workflows/ci-workflow.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 14ff2afe..900a4751 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -18,13 +18,13 @@ jobs: # We want to test across mutiple OSs, defined by our matrix runs-on: ${{ matrix.os }} needs: lint - strategy: + strategy: # Cancel all matrix jobs if one of them fails fail-fast: true matrix: # our matrix for testing across node versions and OSs - node-version: [12, 14] - os: [windows-2019, ubuntu-20.04, ubuntu-22.04] + node-version: [12, 14, 16] + os: [macos-latest, windows-latest, ubuntu-latest] steps: - name: Checkout @@ -43,7 +43,14 @@ jobs: echo npm test # Add here the upload-artifact action - + - shell: bash + run: | + echo 'Test upload artifact' > output.log + - name: Upload output file + uses: actions/upload-artifact@v4 + with: + name: output-log-file + path: output.log # If both linting and CI succeeds we want to deploy the code to a test environment deploy-test: @@ -58,7 +65,10 @@ jobs: uses: actions/checkout@v4 # Add here the download-artifact step - + - name: Download a single artifact + uses: actions/download-artifact@v4 + with: + name: output-log-file # Placeholder - this step would be some action or run commands that deploys the code - name: Deploy to test env From 65a800bdd8cda58869ce46c5dc96d98a5d36fdea Mon Sep 17 00:00:00 2001 From: "Marwan.A" Date: Fri, 24 Oct 2025 11:30:19 -0400 Subject: [PATCH 15/18] Updating CI workflow again --- .github/workflows/ci-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 900a4751..e554056b 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -18,7 +18,7 @@ jobs: # We want to test across mutiple OSs, defined by our matrix runs-on: ${{ matrix.os }} needs: lint - strategy: + strategy: # Cancel all matrix jobs if one of them fails fail-fast: true matrix: @@ -65,7 +65,7 @@ jobs: uses: actions/checkout@v4 # Add here the download-artifact step - - name: Download a single artifact + - name: Download a single artifact uses: actions/download-artifact@v4 with: name: output-log-file From 87145bfbd88066c2cfd60292f6bc1a1decbd0db5 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Fri, 24 Oct 2025 11:44:07 -0400 Subject: [PATCH 16/18] Enable CD workflow on push to main branch --- .github/workflows/cd-workflow.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd-workflow.yml b/.github/workflows/cd-workflow.yml index f8a46600..7145a539 100644 --- a/.github/workflows/cd-workflow.yml +++ b/.github/workflows/cd-workflow.yml @@ -1,9 +1,8 @@ name: 07-2. CD Workflow on: - # push: - # branches: [main] - workflow_dispatch: + push: + branches: [main] env: AZURE_WEBAPP_NAME: your-app-name # set this to your application's name @@ -51,7 +50,10 @@ jobs: steps: # Add here the download-artifact step - + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: node-app - name: Deploy to Prod if: ${{ success() }} From 8823b07e159dcdb115c43c099d2a698b655d40e0 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Fri, 24 Oct 2025 11:48:01 -0400 Subject: [PATCH 17/18] Update ci-workflow.yml From 8f75f7089571449c9a19870db8e68a95b1485154 Mon Sep 17 00:00:00 2001 From: "Marwan.A" <148740073+Marwan8A@users.noreply.github.com> Date: Fri, 24 Oct 2025 11:48:43 -0400 Subject: [PATCH 18/18] Update ci-workflow.yml