diff --git a/.github/workflows/sample-1.yaml b/.github/workflows/sample-1.yaml index bec2522..4cf1290 100644 --- a/.github/workflows/sample-1.yaml +++ b/.github/workflows/sample-1.yaml @@ -9,7 +9,7 @@ jobs: print_hello_world_job: runs-on: ubuntu-latest steps: - - name: Print Hello World Sep 1 + - name: Print Hello World Step 1 run: echo "Hello world!" - - name: Print Hello World Sep 2 + - name: Print Hello World Step 2 run: echo "Great Job!" diff --git a/.github/workflows/sample-2.yaml b/.github/workflows/sample-2.yaml index 8d605d7..51067ba 100644 --- a/.github/workflows/sample-2.yaml +++ b/.github/workflows/sample-2.yaml @@ -6,5 +6,5 @@ jobs: print_scheduled_message_job: runs-on: ubuntu-latest steps: - - name: Print Scheduled Message Sep 1 + - name: Print Scheduled Message Step 1 run: echo "This message is printed every 5 minutes." diff --git a/.github/workflows/sample-3.yaml b/.github/workflows/sample-3.yaml index b45cd0c..3bebfbf 100644 --- a/.github/workflows/sample-3.yaml +++ b/.github/workflows/sample-3.yaml @@ -9,9 +9,9 @@ jobs: steps: - name: Using Checkout Repository uses: actions/checkout@v4 - - name: List Repository Sep 1 + - name: List Repository Step 1 run: echo "Listing repository contents..." - - name: List Repository Sep 2 + - name: List Repository Step 2 run: ls -la - - name: List Repository Sep 3 + - name: List Repository Step 3 run: echo "Repository listing complete!" \ No newline at end of file diff --git a/.github/workflows/sample-4.yaml b/.github/workflows/sample-4.yaml index a0dc238..5fce15f 100644 --- a/.github/workflows/sample-4.yaml +++ b/.github/workflows/sample-4.yaml @@ -1,15 +1,25 @@ -name: List_Variable_Flow +name: List_Variables_Flow on: - workflow_dispatch: + workflow_dispatch: +env: + MY_GLOBAL_VARIABLE: "Any Global Value" # This variable is available to all jobs jobs: - list_variable_job: - runs-on: ubuntu-latest - env: - MY_VARIABLE: "Hello, World!" - steps: - - name: Print Variable Sep 1 - run: echo "The value of MY_VARIABLE is $MY_VARIABLE" - - name: Print Variable Sep 2 - run: echo "The value of SECRET is ${{secrets.MY_TOKEN_SECRET}}" - - name: Print Variable Sep 3 - run: echo "Variable printing complete!" \ No newline at end of file + list_variable_job: + runs-on: ubuntu-latest + env: + MY_LOCAL_VARIABLE: "Hello, World!" # This variable is only available in this job + steps: + - name: Print Variables Step 1 + run: | + echo "The value of MY_GLOBAL_VARIABLE is ${{env.MY_GLOBAL_VARIABLE}}" + echo "The value of MY_LOCAL_VARIABLE is ${{env.MY_LOCAL_VARIABLE}}" + echo "The value of MY_ENV_VARIABLE is ${{vars.MY_TOKEN_VARIABLE}}" + echo "The value of SECRET is ${{secrets.MY_TOKEN_SECRET}}" + list_dynamic_job: + runs-on: ubuntu-latest + steps: + - name: Set Dynamic Variable Step 1 + run: echo "MY_DYNAMIC_VARIABLE=dynamic value" >> $GITHUB_ENV + + - name: Print Dynamic Variable Step 2 + run: echo $MY_DYNAMIC_VARIABLE diff --git a/.github/workflows/sample-4_1.yaml b/.github/workflows/sample-4_1.yaml new file mode 100644 index 0000000..381b5b6 --- /dev/null +++ b/.github/workflows/sample-4_1.yaml @@ -0,0 +1,18 @@ +name: List_Context_Variables_Flow +on: + workflow_dispatch: +jobs: + list_context_job: + runs-on: ubuntu-latest + steps: + - name: Print context Step 1 + run: | + echo "The event that triggered this workflow is ${{ github.event_name }}." + echo "The repository name is ${{ github.repository }}." + echo "The actor who triggered this workflow is ${{ github.actor }}." + - name: Print context Step 2 + run: | + echo "The workflow job name is ${{ job.name }}." + echo "The workflow job status is ${{ job.status }}." + echo "The workflow job steps are ${{ toJson(job.steps) }}." + echo "The workflow job strategy is ${{ toJson(job.strategy) }}." \ No newline at end of file diff --git a/.github/workflows/sample-5.yaml b/.github/workflows/sample-5.yaml new file mode 100644 index 0000000..abb361f --- /dev/null +++ b/.github/workflows/sample-5.yaml @@ -0,0 +1,7 @@ +name: Call_Reusable_Action_Flow +on: + push: + branches: [develop] +jobs: + call_reusable_job: + uses: ./.github/workflows/sample-5_1.yaml \ No newline at end of file diff --git a/.github/workflows/sample-5_1.yaml b/.github/workflows/sample-5_1.yaml new file mode 100644 index 0000000..0237138 --- /dev/null +++ b/.github/workflows/sample-5_1.yaml @@ -0,0 +1,9 @@ +name: Create_Reusable_Action_Flow +on: + workflow_call: +jobs: + create_reusable_job: + runs-on: ubuntu-latest + steps: + - name: Create Reusable Step 1 + run: echo "Called Reusable Workflow!" \ No newline at end of file