github-script | Write workflows scripting the GitHub API in JavaScript | Continous Integration library

 by   actions TypeScript Version: v2.1.0 License: MIT

kandi X-RAY | github-script Summary

kandi X-RAY | github-script Summary

github-script is a TypeScript library typically used in Devops, Continous Integration applications. github-script has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

This action makes it easy to quickly write a script in your workflow that uses the GitHub API and the workflow run context.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              github-script has a medium active ecosystem.
              It has 3322 star(s) with 366 fork(s). There are 34 watchers for this library.
              There were 2 major release(s) in the last 12 months.
              There are 28 open issues and 168 have been closed. On average issues are closed in 64 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of github-script is v2.1.0

            kandi-Quality Quality

              github-script has 0 bugs and 0 code smells.

            kandi-Security Security

              github-script has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              github-script code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              github-script is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              github-script releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of github-script
            Get all kandi verified functions for this library.

            github-script Key Features

            No Key Features are available at this moment for github-script.

            github-script Examples and Code Snippets

            No Code Snippets are available at this moment for github-script.

            Community Discussions

            QUESTION

            Getting `Argument list too long` in GitHub Actions
            Asked 2022-Mar-11 at 11:03

            I am following hashicopr learning guide on how to set up GitHub Actions and terraform. All is running great besides the step to update the PR with the Terraform Plan.

            I am hitting the following error:

            ...

            ANSWER

            Answered 2022-Mar-07 at 03:05

            QUESTION

            Get github.rest.issues.createComment() to use an environment variable for multi-line comment
            Asked 2022-Jan-10 at 15:56

            I have been trying to understand how to get a multi-line comment written to a PR using github actions. I was trying to use github.rest.issues.createComment() as shown in Commenting a pull request... and then handling the multi-line issue by using an environmement variable as shown here: workflow commands. Ultimate goal is to take some multi-line output stdout from a python script (or a log file) and place that as a comment back to the PR that the workflow is running on. The yml file below runs fine up until the last step where I try to access the environment variable I created and use it as the body of the createComment(). The environment variable is created and appears to be available but fails when I try to use it for the body of the comment. Error from github actions is below the code. If I add quotes like body: "${{env.SCRIPT_OUTPUT}}" then I get same error. I would like to use createComment() if possible, I know there is a create comment from Peter Evans that I will likely try next but trying to understand why this is not working.

            ...

            ANSWER

            Answered 2022-Jan-10 at 15:56

            The suggestion from @riqq to use back tics solved the issue. So just had to change body: ${{env.SCRIPT_OUTPUT}} to:

            Source https://stackoverflow.com/questions/70628889

            QUESTION

            How to get a git ref from within GitHub Actions?
            Asked 2021-Dec-09 at 08:04

            This is what I am trying:

            ...

            ANSWER

            Answered 2021-Dec-09 at 08:01

            You don't need the refs/ prefix in that API. Looking at the docs, it says that:

            Returns a single reference from your Git database. The :ref in the URL must be formatted as heads/ for branches and tags/ for tags.

            So if you change your step to the below, it should work.

            Source https://stackoverflow.com/questions/70282817

            QUESTION

            How can I get the latest PR data, specifically milestones when running YAML jobs?
            Asked 2021-Oct-05 at 03:43

            I need to create a YAML job that checks if a milestone is set on a PR and fail an automated check if there is no milestone set.

            This is the job that I have in the .yml file:

            ...

            ANSWER

            Answered 2021-Oct-05 at 03:43

            You can use a Github API call in github-script action using github.request like this:

            Source https://stackoverflow.com/questions/69434370

            QUESTION

            Add check to a specific workflow-run/check-suite using octokit
            Asked 2021-Sep-15 at 06:56

            I have a project with Github Actions that implements multiple workflows that can be triggered by a single push event (depending on path filter).

            So a push with a single commit can trigger multiple workflows, so far so good.

            In each workflow I am running actions/github-script to create dynamic run-checks with the following step:

            ...

            ANSWER

            Answered 2021-Sep-14 at 17:54

            Try setting Custom Script to something different for each check run you create. I think multiple check runs with the same names are collapsed into only showing the last one. The reason is that that way you can override an status on a commit, by using the same name.

            Source https://stackoverflow.com/questions/69178167

            QUESTION

            How can I use a Github action's output in a workflow?
            Asked 2021-Apr-27 at 13:42

            Let's take this example composite action found on Github's documentation:

            ...

            ANSWER

            Answered 2021-Apr-27 at 13:42

            It seems my attempt was correct with the exception of one detail:

            Instead of:

            Source https://stackoverflow.com/questions/67283976

            QUESTION

            How to set event triggers per job rather than per workflow?
            Asked 2021-Apr-23 at 16:57

            Let's take as an example this workflow with two jobs - build and comment:

            ...

            ANSWER

            Answered 2021-Apr-23 at 16:57

            You can use the if conditional (reference) to prevent a job or a step from running unless a condition is met.

            For example, here, you could add if: ${{ github.event_name == 'pull_request' }} to the comment job to execute it only if the event that triggered the workflow is a pull_request.

            Source https://stackoverflow.com/questions/67232614

            QUESTION

            Retrieve the output error from a github actions step
            Asked 2021-Feb-25 at 07:46

            I am trying to build a GitHub workflow that performs simple pre-commit checks whenever a PR is created into a certain repository and triggers a message if some check has failed. The problem is that I want that message to be as specific as possible and, therefore, the message has to contain the error that is preventing the check to succeed. To perform the pre-commit check I am using pre-commit action and, to automate the messages, I am using the official actions github-script.

            Since I am utilizing the pre-commit action to perform the checks, I think I am not able to use the set-output solution to define the outputs of the step that is validating for the errors and reference those outputs later in my error message. Is there any other way to workaround this problem?

            Here is an excerpt of my workflow pipeline:

            ...

            ANSWER

            Answered 2021-Feb-25 at 07:46

            It is not possible using the provided action. Unless there is some kind of command line argument you can pass to pre-commit to write the error to a file and then pass it around. I went through the doc but didn't find any.

            If you really need this, you will have to write your own action.

            Source https://stackoverflow.com/questions/66358647

            QUESTION

            How to access GraphQL mutation result in Github Workflow
            Asked 2021-Feb-04 at 21:29

            I have a step in a github workflow job that looks like this:

            ...

            ANSWER

            Answered 2021-Jan-22 at 13:44

            Well, console.log(result.addComment.commentEdge.node.id) does the trick.

            Source https://stackoverflow.com/questions/65801016

            QUESTION

            Is it possible to find out, via the GitHub API, if an issue has been closed via a pull request
            Asked 2020-Oct-09 at 19:05

            I'm using github-script for GitHub actions, which allows you to easily access GitHub API. I'm trying to check if an issue has not been closed by clicking on the "close button", that is, via a commit or via merging a pull request that includes a closing commit (or closes in the PR body). However, there does not seem an easy way to do that. This is the event information the GitHub API returns:

            • If the issue has been closed from a commit, it adds the commit_id
            • If the issue has been closed from GitHub app (this does not include the web, apparently), performed_via_github_app is set to non-null.

            However, there does not seem to be a special way to signal an issue has been closed by a pull request, apparently. Or is it?

            ...

            ANSWER

            Answered 2020-Oct-05 at 15:38

            Well, short answer is no, there's no way to do this and the GitHub API does not reveal either the PR it's been closed from or the fact that it's been closed from a PR as opposed to a commit. So we'll have to settle for second-best. Often the issue is connected to the PR in the previous event. Unless it's an open PR and you've already merged a commit that mentions the issue, you'll have a connected and closed event the one after the other. So you can use this (or similar) to check for PRs:

            Source https://stackoverflow.com/questions/64203293

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install github-script

            You can use the github object to access the Octokit API. For instance, github.request. This will print the full diff object in the screen; result.data will contain the actual diff text.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/actions/github-script.git

          • CLI

            gh repo clone actions/github-script

          • sshUrl

            git@github.com:actions/github-script.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Continous Integration Libraries

            chinese-poetry

            by chinese-poetry

            act

            by nektos

            volkswagen

            by auchenberg

            phpdotenv

            by vlucas

            watchman

            by facebook

            Try Top Libraries by actions

            runner-images

            by actionsPowerShell

            starter-workflows

            by actionsTypeScript

            virtual-environments

            by actionsPowerShell

            checkout

            by actionsTypeScript

            toolkit

            by actionsTypeScript