forked from microsoftgraph/msgraph-beta-sdk-dotnet
53 lines (45 loc) · 2.73 KB
/
create-pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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 like beta/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: "beta/pipelinebuild/*"
on:
push:
branches:
- "beta/pipelinebuild/*"
paths:
- 'src/**/*.cs'
# 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') && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]')
# 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.3.0
# Create a pull request [1]
- name: Create PR using the GitHub REST API via hub
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE_TITLE: Generated beta models and request builders using Typewriter
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 - [ ] Check that the changes match the changes in the captured commit for [beta_metadata.xml](https://github.com/microsoftgraph/msgraph-metadata/blob/master/beta_metadata.xml)"
REVIEWERS: peombwa,ddyett,zengin,baywet,nikithauc
ASSIGNEDTO: MIchaelMainer
LABELS: generated
BASE: master
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" -r "$REVIEWERS" -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