async function run() {
  try {
    const organization = core.getInput("organization");
    const project_number = core.getInput("project_number");
    const only_labeled = core.getInput("only_labeled").split(',');

    const content_metadata = getContentMetadata(github.context);

    if(!labelFilterMatch(only_labeled, content_metadata.labels)) {
      console.info("No matching labels. Skipping");
      return;
    }

    core.info(`Going to add '${content_metadata.id}' to ${organization}/${project_number}`);

    const octokit = github.getOctokit(core.getInput("token"));

    const project_metadata_resp = await octokit.graphql(
      project_metadata_query,
      { org: organization, number: parseInt(project_number) }
    );
    core.debug("Project Metadata:")
    core.debug(JSON.stringify(project_metadata_resp));

    const project_id = project_metadata_resp["organization"]["projectNext"]["id"];
    core.debug(`Found project_id: ${project_id}`);

    const mutation_resp = await octokit.graphql(
      add_to_project_mutation,
      { project: project_id, target: content_metadata.id }
    );
    core.debug("Mutation Response:")
    core.debug(JSON.stringify(mutation_resp));

    const card_id = mutation_resp["addProjectNextItem"]["projectNextItem"]["id"];
    core.info(`Added to board as card_id: '${card_id}'`);

    core.setOutput('card_id', card_id);
  } catch (error) {
    core.setFailed(error.message);
  }
}
// most @actions toolkit packages have async methods
most @actions toolkit packages have async methods
most @actions toolkit packages have async methods
async function run() {
  try {
    const organization = core.getInput("organization");
    const project_number = core.getInput("project_number");
    const only_labeled = core.getInput("only_labeled").split(',');
    const content_metadata = getContentMetadata(github.context);
    if(!labelFilterMatch(only_labeled, content_metadata.labels)) {
      console.info("No matching labels. Skipping");
      return;
    }
    core.info(`Going to add '${content_metadata.id}' to ${organization}/${project_number}`);
    const octokit = github.getOctokit(core.getInput("token"));
    const project_metadata_resp = await octokit.graphql(
      project_metadata_query,
      { org: organization, number: parseInt(project_number) }
    );
    core.debug("Project Metadata:")
    core.debug(JSON.stringify(project_metadata_resp));
    const project_id = project_metadata_resp["organization"]["projectNext"]["id"];
    core.debug(`Found project_id: ${project_id}`);
    const mutation_resp = await octokit.graphql(
      add_to_project_mutation,
      { project: project_id, target: content_metadata.id }
    );
    core.debug("Mutation Response:")
    core.debug(JSON.stringify(mutation_resp));
    const card_id = mutation_resp["addProjectNextItem"]["projectNextItem"]["id"];
    core.info(`Added to board as card_id: '${card_id}'`);
    core.setOutput('card_id', card_id);
  } catch (error) {
    core.setFailed(error.message);
  }
}
async function run ( ) { try { const organization = core . getInput ( "organization" ) ; const project_number = core . getInput ( "project_number" ) ; const only_labeled = core . getInput ( "only_labeled" ) . split ( ',' ) ; const content_metadata = getContentMetadata ( github . context ) ; if ( ! labelFilterMatch ( only_labeled , content_metadata . labels ) ) { console . info ( "No matching labels. Skipping" ) ; return ; } core . info ( ` ${ content_metadata . id } ${ organization } ${ project_number } ` ) ; const octokit = github . getOctokit ( core . getInput ( "token" ) ) ; const project_metadata_resp = await octokit . graphql ( project_metadata_query , { org : organization , number : parseInt ( project_number ) } ) ; core . debug ( "Project Metadata:" ) core . debug ( JSON . stringify ( project_metadata_resp ) ) ; const project_id = project_metadata_resp [ "organization" ] [ "projectNext" ] [ "id" ] ; core . debug ( ` ${ project_id } ` ) ; const mutation_resp = await octokit . graphql ( add_to_project_mutation , { project : project_id , target : content_metadata . id } ) ; core . debug ( "Mutation Response:" ) core . debug ( JSON . stringify ( mutation_resp ) ) ; const card_id = mutation_resp [ "addProjectNextItem" ] [ "projectNextItem" ] [ "id" ] ; core . info ( ` ${ card_id } ` ) ; core . setOutput ( 'card_id' , card_id ) ; } catch ( error ) { core . setFailed ( error . message ) ; } }
most @actions toolkit packages have async methods
most @actions toolkit packages have async methods