Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #24

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
18 changes: 18 additions & 0 deletions .github/actions/javascript/hashBranchName/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Hash Branch Name'
description: 'Hash Branch Name'
inputs:
EVENT_NAME:
description: Name of the event that triggered the wrokflow
required: true
PULL_REQUEST_HEAD_REF:
description: Branch name if the workflow was triggered by PR target
required: false
REF_NAME:
description: Branch name if the workflow was triggered by workflow_dispatch (if by PR target it's PR ref)
required: true
outputs:
BRANCH_NAME_HASH:
description: Branch name hash
runs:
using: 'node16'
main: './index.js'
16 changes: 16 additions & 0 deletions .github/actions/javascript/hashBranchName/hashBranchName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable no-bitwise */
const core = require('@actions/core');

const eventName = core.getInput('EVENT_NAME');
const pullRequestHeadRef = core.getInput('PULL_REQUEST_HEAD_REF');
const refName = core.getInput('REF_NAME');

const hashBranchName = function () {
if (eventName === 'workflow_dispatch') {
return btoa(refName).replace(/[^a-zA-Z0-9 ]/g, '');;
} else {
return btoa(pullRequestHeadRef).replace(/[^a-zA-Z0-9 ]/g, '');;
}
};

core.setOutput('BRANCH_NAME_HASH', hashBranchName());
Loading