From 14d0dd9bfe9e176d2e5b48162d1896a7715f1a9f Mon Sep 17 00:00:00 2001 From: Yurii Dukhovnyi Date: Wed, 18 Oct 2023 15:29:30 +0300 Subject: [PATCH] pass branch-name --- .github/actions/deployment-action/action.yml | 10 +++++----- .github/actions/deployment-action/deployment-action.js | 9 ++++++++- .github/workflows/deployment.yml | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/actions/deployment-action/action.yml b/.github/actions/deployment-action/action.yml index 3c1fd1a78..e047e4dfd 100644 --- a/.github/actions/deployment-action/action.yml +++ b/.github/actions/deployment-action/action.yml @@ -1,10 +1,10 @@ name: 'Deployment validation' description: 'Validates if deployment action can be run' -# inputs: -# branch-name: # the branch -# description: 'Who to greet' -# required: true -# default: 'World' +inputs: + branch-name: + description: 'The branch name should be validated' + required: true + default: '' runs: using: 'node20' main: 'deployment-action.js' diff --git a/.github/actions/deployment-action/deployment-action.js b/.github/actions/deployment-action/deployment-action.js index 8f1c458f8..465286bce 100644 --- a/.github/actions/deployment-action/deployment-action.js +++ b/.github/actions/deployment-action/deployment-action.js @@ -2,7 +2,14 @@ const core = require('@actions/core'); const github = require('@actions/github'); try { - console.log(github.context); + const branchName = core.getInput("branch-name"); + console.log(`The branch name is "${branchName}" from param.`); + + const payload = JSON.stringify(github.context.payload, undefined, 2) + + console.log(payload); + + console.log(payload["pull_request"]["head"]["ref"]); } catch(error) { core.setFailed(error.message); } \ No newline at end of file diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 2f69860b5..1f22d7581 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -12,7 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/deployment-action + - name: Validate branch name before to start deployment + uses: ./.github/actions/deployment-action + with: + branch-name: ${{ github.ref }} # - uses: actions/checkout@v3 # - name: Runs the deployment workflow in Bitrise # run: |