Giter Site home page Giter Site logo

merged-pr-info-action's Introduction

merged-pr-info-action

A composite GitHub Action to get information about a pull request merged into the default branch. For instance, we are able to notice the CI jobs on the default branch are passed to the creator of the merged pull request using the github-script action.

Inputs

Please look into action.yml to see the inputs.

  • github-token: The GitHub token to access the GitHub API.

Outputs

  • pull-request-number: The number of the pull request.
  • pull-request-creator: The creator of the pull request.

Use cases

Comment to the merged pull request if all jobs are passed

The examples show how to comment to the merged pull request if all jobs are passed. We assume that the job1 and job2 are the jobs that are executed when the pull request is merged into the default branch. Those can be something like to deploy a product.

name: Comment to the merged pull request
on:
  push:
    branches:
      - main
jobs:
  job1:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Hello, world!"
  job2:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Hello, world!"

  comment:
    needs: [job1, job2]
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: yu-iskw/[email protected]
        id: merged-pr-info
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: "Comment to the merged pull request"
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          debug: true
          script: |
            const pr_number = "${{ steps.merged-pr-info.outputs.pull-request-number }}";
            await github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: pr_number,
              body: "@" + "${{ steps.merged-pr-info.outputs.pull-request-creator }}" +  " The jobs are passed!"
            });
            console.log(`Commented to the pull request ${pr_number}`);

merged-pr-info-action's People

Contributors

yu-iskw avatar cmac4603 avatar

Watchers

 avatar  avatar

merged-pr-info-action's Issues

Security Policy violation SECURITY.md

This issue was automatically created by Allstar.

Security Policy Violation
Security policy not enabled.
A SECURITY.md file can give users information about what constitutes a vulnerability and how to report one securely so that information about a bug is not publicly visible. Examples of secure reporting methods include using an issue tracker with private issue support, or encrypted email with a published key.

To fix this, add a SECURITY.md file that explains how to handle vulnerabilities found in your repository. Go to https://github.com/yu-iskw/merged-pr-info-action/security/policy to enable.

For more information, see https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository.


This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.