# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This action will automatically create a pull request against master if the pushed branch # has a branch path spec likev 1.0/pipelinebuild/*. Configure this action by updating the # environment variable values[0]. name: "create pull request" # Controls when the action will run. Triggers the workflow on push # events but only for branches with the following branch spec: "v1.0/pipelinebuild/*" on: push: branches: - "v1.0/pipelinebuild/*" # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "create-pull-request" create-pull-request: # GitHub Actions don't support skip ci yet like Azure Pipelines so this check will do the same. if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false # The type of runner that the job will run on runs-on: ubuntu-latest # https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 # Create a pull request [1] - name: Create PR using the GitHub REST API via hub shell: bash env: GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} MESSAGE_TITLE: Generated v1.0 models and request builders using Kiota 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." ASSIGNEDTO: baywet LABELS: generated BASE: main run: | curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -a "$ASSIGNEDTO" -l "$LABELS" # References # [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables # [1] https://hub.github.com/hub-pull-request.1.html # https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token