From 3759b5ced62fadb9304f5b2a7c821bb62d0fad18 Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Thu, 23 Nov 2023 12:44:49 +0545 Subject: [PATCH] common5 --- .github/workflows/actions.yml | 38 ++++++++++++++++++++++ .github/workflows/main.yml | 27 +++++++++------- .github/workflows/release.yml | 18 +++++------ .github/workflows/shared_steps.yml | 52 +++++++++++++++--------------- 4 files changed, 88 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/actions.yml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..1548e6f --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,38 @@ +name: Filter Issues CI/CD + +on: + push: + branches: [main] + pull_request: + branches: [main, try_cron] + schedule: + - cron: "*/6 * * * *" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + branch: + - main + - try_cron + exclude: + - if: github.event_name != 'schedule' && matrix.branch == 'try_cron' + steps: + - name: checkout + if: (github.event_name == 'schedule') + uses: actions/checkout@v2 + with: + ref: ${{ matrix.branch }} + + - name: Install node required + uses: actions/setup-node@v3 + with: + node-version: 16.x + + - name: Install dependencies + run: npm ci + + - name: run hello.js + run: | + node ./hello.js \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c90dece..97344ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,14 +1,17 @@ -name: Main Workflow +# name: Main Workflow -on: - push: - branches: - - main - schedule: - - cron: "*/6 * * * *" +# on: +# push: +# branches: +# - main +# pull_request: +# branches: +# - main +# schedule: +# - cron: "*/6 * * * *" -jobs: - main: - uses: ./.github/workflows/shared_steps.yml - with: - branch: main +# jobs: +# main: +# uses: ./.github/workflows/shared_steps.yml +# with: +# branch: main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d48b9ad..883fa34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ -name: Release Workflow +# name: Release Workflow -on: - schedule: - - cron: "*/6 * * * *" +# on: +# schedule: +# - cron: "*/6 * * * *" -jobs: - try_cron: - uses: ./.github/workflows/shared_steps.yml - with: - branch: try_cron +# jobs: +# try_cron: +# uses: ./.github/workflows/shared_steps.yml +# with: +# branch: try_cron diff --git a/.github/workflows/shared_steps.yml b/.github/workflows/shared_steps.yml index ccda0d4..f5fd747 100644 --- a/.github/workflows/shared_steps.yml +++ b/.github/workflows/shared_steps.yml @@ -1,33 +1,33 @@ -name: Shared Steps +# name: Shared Steps -on: - workflow_call: - inputs: - branch: - type: string +# on: +# workflow_call: +# inputs: +# branch: +# type: string -jobs: - build: - runs-on: ubuntu-latest +# jobs: +# build: +# runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 - with: - ref: ${{ inputs.branch }} +# steps: +# - name: checkout +# uses: actions/checkout@v2 +# with: +# ref: ${{ inputs.branch }} - - name: Get branch name - run: | - echo "Branch name from trigger: ${{ inputs.branch }}" +# - name: Get branch name +# run: | +# echo "Branch name from trigger: ${{ inputs.branch }}" - - name: Install node required - uses: actions/setup-node@v3 - with: - node-version: 16.x +# - name: Install node required +# uses: actions/setup-node@v3 +# with: +# node-version: 16.x - - name: Install dependencies - run: npm ci +# - name: Install dependencies +# run: npm ci - - name: run hello.js - run: | - node ./hello.js +# - name: run hello.js +# run: | +# node ./hello.js