Skip to content

Commit

Permalink
Bunch of internal chores, linting etc
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Aug 3, 2024
1 parent ff8b017 commit 35e3108
Show file tree
Hide file tree
Showing 7 changed files with 496 additions and 409 deletions.
37 changes: 0 additions & 37 deletions .eslintrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 120
}
16 changes: 11 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29043,16 +29043,22 @@ function run() {
// Get octokit client for making API calls
const octokit = github.getOctokit(token);
// List workflows via API, and handle paginated results
const workflows = yield octokit.paginate(octokit.rest.actions.listRepoWorkflows.endpoint.merge({ owner, repo, ref, inputs }));
const workflows = yield octokit.paginate(octokit.rest.actions.listRepoWorkflows.endpoint.merge({
owner,
repo,
ref,
inputs,
}));
// Debug response if ACTIONS_STEP_DEBUG is enabled
core.debug('### START List Workflows response data');
core.debug(JSON.stringify(workflows, null, 3));
core.debug('### END: List Workflows response data');
// Locate workflow either by name, id or filename
const foundWorkflow = workflows.find((workflow) => {
return workflow.name === workflowRef ||
return (workflow.name === workflowRef ||
workflow.id.toString() === workflowRef ||
workflow.path.endsWith(workflowRef);
workflow.path.endsWith(`/${workflowRef}`) || // Add a leading / to avoid matching workflow with same suffix
workflow.path == workflowRef); // Or it stays in top level directory
});
if (!foundWorkflow)
throw new Error(`Unable to find workflow '${workflowRef}' in ${owner}/${repo} 😥`);
Expand All @@ -29061,7 +29067,7 @@ function run() {
console.log('🚀 Calling GitHub API to dispatch workflow...');
const dispatchResp = yield octokit.request(`POST /repos/${owner}/${repo}/actions/workflows/${foundWorkflow.id}/dispatches`, {
ref: ref,
inputs: inputs
inputs: inputs,
});
core.info(`🏆 API response status: ${dispatchResp.status}`);
core.setOutput('workflowId', foundWorkflow.id);
Expand Down Expand Up @@ -30937,7 +30943,7 @@ module.exports = parseParams
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"workflow-dispatch","version":"1.2.1","description":"Trigger running GitHub Actions workflows","main":"dist/index.js","scripts":{"build":"ncc build src/main.ts -o dist","lint":"eslint src/"},"keywords":["github","actions"],"author":"Ben Coleman","license":"MIT","devDependencies":{"@actions/core":"^1.10.0","@actions/github":"^6.0.0","@vercel/ncc":"^0.38.1","@typescript-eslint/eslint-plugin":"^7.2.0","@typescript-eslint/parser":"^7.2.0","eslint":"^8.57.0","typescript":"^5.4.2"}}');
module.exports = JSON.parse('{"name":"workflow-dispatch","version":"1.2.","description":"Trigger running GitHub Actions workflows","main":"dist/index.js","scripts":{"build":"ncc build src/main.ts -o dist","lint":"eslint src/","lint-fix":"eslint src/ --fix","format":"prettier --write src/"},"keywords":["github","actions"],"author":"Ben Coleman","license":"MIT","devDependencies":{"@actions/core":"^1.10.1","@actions/github":"^6.0.0","@vercel/ncc":"^0.38.1","typescript-eslint":"^8.0.0","eslint":"^9.8.0","typescript":"^5.5.4","prettier":"^3.3.3"}}');

/***/ })

Expand Down
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-check

import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, ...tseslint.configs.strict)
Loading

0 comments on commit 35e3108

Please sign in to comment.