Skip to content

Commit

Permalink
pass branch-name
Browse files Browse the repository at this point in the history
  • Loading branch information
yurii-glia committed Oct 18, 2023
1 parent 6addfee commit 671b86d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/actions/deployment-action/action.yml
Original file line number Diff line number Diff line change
@@ -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'
6 changes: 5 additions & 1 deletion .github/actions/deployment-action/deployment-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
5 changes: 4 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 671b86d

Please sign in to comment.