Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit f9cf3b6

Browse files
authored
Merge pull request #1 from microsoftgraph/chore/pipelines
Add workflow to create pull requests automatically
2 parents 0ab23d8 + 69af176 commit f9cf3b6

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @calebkiage @baywet @zengin @MichaelMainer @andrueastman @peombwa @jobala @samwelkanda
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 main if the pushed branch
5+
# has a branch path spec like beta/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: "beta/pipelinebuild/*"
12+
on:
13+
push:
14+
branches:
15+
- "beta/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+
# GitHub Actions don't support skip ci yet like Azure Pipelines so this check will do the same.
22+
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
23+
# The type of runner that the job will run on
24+
runs-on: ubuntu-latest
25+
# https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md
26+
27+
steps:
28+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
29+
- uses: actions/[email protected]
30+
31+
# Create a pull request [1]
32+
- name: Create PR using the GitHub REST API via hub
33+
shell: bash
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
36+
MESSAGE_TITLE: Generated beta models and request builders using Kiota
37+
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."
38+
ASSIGNEDTO: calebkiage
39+
LABELS: generated
40+
BASE: main
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" -a "$ASSIGNEDTO" -l "$LABELS"
44+
45+
# References
46+
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
47+
# [1] https://hub.github.com/hub-pull-request.1.html
48+
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

0 commit comments

Comments
 (0)