Skip to content

Commit

Permalink
Allow overriding the command passed to Expo
Browse files Browse the repository at this point in the history
You may want to call into the command action using a provided command
string rather than what comes from the GitHub Action.

This is useful if you want to write an action that listens for a
specific shortcut (e.g. `#release production`) which then calls the
expo/eas command supported by the official action. Then you benefit from
the nice shortcut, remove the possibility of misconfiguration, while
keeping the official GHA's behaviour like posting builds back to the PR
or responding to the original comment.
  • Loading branch information
lawrencejones committed Jun 4, 2024
1 parent 89b4994 commit 8e802bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/actions/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function commandInput() {
return {
reaction: '+1' as Reaction['content'],
githubToken: getInput('github-token'),
commandOverride: getInput('command-override'),
};
}

Expand All @@ -31,7 +32,13 @@ export async function commandAction(input = commandInput()) {
return;
}

const command = parseCommand(comment);
let commandSource = comment;
if (input.commandOverride) {
info(`Overriding command with: ${input.commandOverride}`);
commandSource = input.commandOverride;
}

const command = parseCommand(commandSource);
if (!command) {
info("Comment didn't contain a valid expo/eas command");
return;
Expand Down

0 comments on commit 8e802bf

Please sign in to comment.