|
| 1 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +# This action will automatically create a pull request against master if the pushed branch |
| 5 | +# has a branch path spec likev 1.0/pipelinebuild/*. Configure this action by updating the |
| 6 | +# environment variable values[0]. |
| 7 | + |
| 8 | +name: "create pull request" |
| 9 | + |
| 10 | +# Controls when the action will run. Triggers the workflow on push |
| 11 | +# events but only for branches with the following branch spec: "v1.0/pipelinebuild/*" |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: |
| 15 | + - "v1.0/pipelinebuild/*" |
| 16 | + |
| 17 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 18 | +jobs: |
| 19 | + # This workflow contains a single job called "create-pull-request" |
| 20 | + create-pull-request: |
| 21 | + # The type of runner that the job will run on |
| 22 | + runs-on: ubuntu-latest |
| 23 | + # https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md |
| 24 | + |
| 25 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 26 | + steps: |
| 27 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + |
| 30 | + # Create a pull request [1] |
| 31 | + - name: Create PR using the GitHub REST API via hub |
| 32 | + shell: bash |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + MESSAGE_TITLE: Generated models and request builders using Typewriter |
| 36 | + MESSAGE_BODY: "This pull request was automatically created by the GitHub Action, **${{github.workflow}}**. \n\n The commit hash is _${{github.sha}}_. \n\n **Important** Check for unexpected deletions or changes in this PR. \n\n cc: @darrelmiller" |
| 37 | + REVIEWERS: peombwa,ddyett |
| 38 | + ASSIGNEDTO: MIchaelMainer |
| 39 | + LABELS: generated |
| 40 | + BASE: dev |
| 41 | + run: | |
| 42 | + curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 |
| 43 | + bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -a "$ASSIGNEDTO" -l "$LABELS" |
| 44 | +# References |
| 45 | +# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables |
| 46 | +# [1] https://hub.github.com/hub-pull-request.1.html |
| 47 | +# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token |
0 commit comments