From 671b86d800be0ff7190f009ba6a5f93779542531 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 | 6 +++++- .github/workflows/deployment.yml | 5 ++++- 3 files changed, 14 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..f142220b6 100644 --- a/.github/actions/deployment-action/deployment-action.js +++ b/.github/actions/deployment-action/deployment-action.js @@ -2,7 +2,11 @@ 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 ref = github.context.payload.pull_request["head"]["ref"] + console.log(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: |