mirror of
				https://github.com/actions-rs/cargo.git
				synced 2025-11-03 22:31:58 +02:00 
			
		
		
		
	Add formatting and linting tools
This commit is contained in:
		
							parent
							
								
									ecffd7835a
								
							
						
					
					
						commit
						efdda56b63
					
				
					 14 changed files with 2826 additions and 472 deletions
				
			
		
							
								
								
									
										26
									
								
								src/input.ts
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								src/input.ts
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,31 +2,31 @@
 | 
			
		|||
 * Parse action input into a some proper thing.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import {input} from '@actions-rs/core';
 | 
			
		||||
import { input } from "@actions-rs/core";
 | 
			
		||||
 | 
			
		||||
import stringArgv from 'string-argv';
 | 
			
		||||
import stringArgv from "string-argv";
 | 
			
		||||
 | 
			
		||||
// Parsed action input
 | 
			
		||||
export interface Input {
 | 
			
		||||
    command: string,
 | 
			
		||||
    toolchain?: string,
 | 
			
		||||
    args: string[],
 | 
			
		||||
    useCross: boolean,
 | 
			
		||||
    command: string;
 | 
			
		||||
    toolchain?: string;
 | 
			
		||||
    args: string[];
 | 
			
		||||
    useCross: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function get(): Input {
 | 
			
		||||
    const command = input.getInput('command', {required: true});
 | 
			
		||||
    const args = stringArgv(input.getInput('args'));
 | 
			
		||||
    let toolchain = input.getInput('toolchain');
 | 
			
		||||
    if (toolchain.startsWith('+')) {
 | 
			
		||||
    const command = input.getInput("command", { required: true });
 | 
			
		||||
    const args = stringArgv(input.getInput("args"));
 | 
			
		||||
    let toolchain = input.getInput("toolchain");
 | 
			
		||||
    if (toolchain.startsWith("+")) {
 | 
			
		||||
        toolchain = toolchain.slice(1);
 | 
			
		||||
    }
 | 
			
		||||
    const useCross = input.getInputBool('use-cross');
 | 
			
		||||
    const useCross = input.getInputBool("use-cross");
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        command: command,
 | 
			
		||||
        args: args,
 | 
			
		||||
        useCross: useCross,
 | 
			
		||||
        toolchain: toolchain || undefined
 | 
			
		||||
    }
 | 
			
		||||
        toolchain: toolchain || undefined,
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								src/main.ts
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.ts
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
const path = require('path');
 | 
			
		||||
import path from "path";
 | 
			
		||||
 | 
			
		||||
import * as core from '@actions/core';
 | 
			
		||||
import * as core from "@actions/core";
 | 
			
		||||
 | 
			
		||||
import * as input from './input';
 | 
			
		||||
import {Cargo, Cross} from '@actions-rs/core';
 | 
			
		||||
import * as input from "./input";
 | 
			
		||||
import { Cargo, Cross } from "@actions-rs/core";
 | 
			
		||||
 | 
			
		||||
export async function run(actionInput: input.Input): Promise<void> {
 | 
			
		||||
    let program;
 | 
			
		||||
| 
						 | 
				
			
			@ -24,8 +24,8 @@ export async function run(actionInput: input.Input): Promise<void> {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
async function main(): Promise<void> {
 | 
			
		||||
    const matchersPath = path.join(__dirname, '.matchers');
 | 
			
		||||
    console.log(`::add-matcher::${path.join(matchersPath, 'rust.json')}`);
 | 
			
		||||
    const matchersPath = path.join(__dirname, ".matchers");
 | 
			
		||||
    console.log(`::add-matcher::${path.join(matchersPath, "rust.json")}`);
 | 
			
		||||
 | 
			
		||||
    const actionInput = input.get();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue