Skip to content

Commit

Permalink
Add useFilepath parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
extempl committed Aug 31, 2021
1 parent 8794bb5 commit 8bcc284
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
filename:
description: The Lokalise filename to use on new keys
required: true
use-filepath:
description: Use full filepath as a filename
required: false
ref:
description: Branch ref for tagging
required: false
Expand Down
3 changes: 2 additions & 1 deletion core.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ module.exports = async (context, { LokaliseApi, fs }) => {
function buildLokaliseCreateKeysRequest (toCreate) {
console.log('Keys to push:');
const uploadKeys = [];
const filename = _context.useFilepath === 'true' ? path.join(_context.directory, _context.filename) : _context.filename;
Object.keys(toCreate).forEach(key => {
console.log(' ' + key);
const lokaliseKey = {
key_name: key,
platforms: [_context.platform],
translations: [],
filenames: {
[_context.platform]: _context.filename
[_context.platform]: filename
}
};
if (_context.ref) {
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ module.exports = async (context, { LokaliseApi, fs }) => {
function buildLokaliseCreateKeysRequest (toCreate) {
console.log('Keys to push:');
const uploadKeys = [];
const filename = _context.useFilepath === 'true' ? path.join(_context.directory, _context.filename) : _context.filename;
Object.keys(toCreate).forEach(key => {
console.log(' ' + key);
const lokaliseKey = {
key_name: key,
platforms: [_context.platform],
translations: [],
filenames: {
[_context.platform]: _context.filename
[_context.platform]: filename
}
};
if (_context.ref) {
Expand Down Expand Up @@ -10127,6 +10128,7 @@ const directory = ghCore.getInput('directory');
const format = ghCore.getInput('format');
const platform = ghCore.getInput('platform');
const filename = ghCore.getInput('filename');
const useFilepath = ghCore.getInput('use-filepath');
const ref = ghCore.getInput('ref');

core({
Expand All @@ -10136,6 +10138,7 @@ core({
format,
platform,
filename,
useFilepath,
ref
}, {
LokaliseApi,
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const directory = ghCore.getInput('directory');
const format = ghCore.getInput('format');
const platform = ghCore.getInput('platform');
const filename = ghCore.getInput('filename');
const useFilepath = ghCore.getInput('use-filepath');
const ref = ghCore.getInput('ref');

core({
Expand All @@ -19,6 +20,7 @@ core({
format,
platform,
filename,
useFilepath,
ref
}, {
LokaliseApi,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "push-lokalise-keys",
"version": "3.6.2",
"version": "3.6.3",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 8bcc284

Please sign in to comment.