Skip to content

Commit

Permalink
Merge pull request #1 from iautom8things/major/test_pr
Browse files Browse the repository at this point in the history
add test for PR
  • Loading branch information
iautom8things committed Jun 27, 2021
2 parents 7e8d0ae + a6fa449 commit b5be292
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ jobs:
run: npm run package
- name: Run Action
uses: ./
- name: Run Action from Opened PR
if: github.event_name == 'pull_request' && github.event.pull_request.merged_by == ''
uses: ./
with:
major_pattern: "/^(breaking|major)//"
minor_pattern: "/^(feature|feat|minor)//"
use_test_value: "true"
test_value: breaking/foo
test_value: ${{ github.event.pull_request.head.ref }}
id: run
15 changes: 0 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const shortTags = core.getInput('short_tags') === 'true';
const bumpEachCommit = core.getInput('bump_each_commit') === 'true';
const rawUseTestValue = core.getInput('use_test_value');
const useTestValue = rawUseTestValue === 'true';
core.warning(`raw use: ${rawUseTestValue} parsed: ${useTestValue}`)

const cmd = async (command, ...args) => {
let output = '', errors = '';
Expand Down Expand Up @@ -76,9 +75,6 @@ const setOutput = (major, minor, patch, increment, changed, branch, namespace) =
core.setOutput("increment", increment.toString());
core.setOutput("changed", changed.toString());
core.setOutput("version_tag", tag);
core.setOutput("raw_use_test_value", rawUseTestValue);
core.setOutput("use_test_value", useTestValue);


};

Expand Down Expand Up @@ -227,35 +223,24 @@ async function run() {
return;
}

core.setOutput("test_value", testValue);
if (useTestValue) {
core.warning(`Test Value: ${testValue} -- major pattern ${majorPattern(testValue)} -- minor pattern ${minorPattern(testValue)}`);
core.info(`Test Value: ${testValue} -- major pattern ${majorPattern(testValue)} -- minor pattern ${minorPattern(testValue)}`);
core.error(`Test Value: ${testValue} -- major pattern ${majorPattern(testValue)} -- minor pattern ${minorPattern(testValue)}`);
core.setOutput("in_use_test_value", true);
if (majorPattern(testValue)) {
major++;
minor = 0;
patch = 0;
core.setOutput("major_true", true);
core.warning(`bump major`)
} else if (minorPattern(testValue)) {
minor++;
patch = 0;
core.setOutput("minor_true", true);
core.warning(`bump minor`)
} else {
patch++;
core.setOutput("patch_true", true);
core.warning(`bump patch`)
}
increment = history.length - 1;
setOutput(major, minor, patch, increment, changed, versionBranch, namespace);
return;
} else {
core.warning(`useTestValue: ${rawUseTestValue} ${useTestValue}`);
core.info(`useTestValue: ${rawUseTestValue} ${useTestValue}`);
core.error(`useTestValue: ${rawUseTestValue} ${useTestValue}`);
}

// Discover the change time from the history log by finding the oldest log
Expand Down

0 comments on commit b5be292

Please sign in to comment.