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

Commit 6199f64

Browse files
committed
Add workflow to create pull requests automatically
1 parent 240a8d3 commit 6199f64

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 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+
# 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 represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
- uses: actions/[email protected]
31+
32+
# Create a pull request [1]
33+
- name: Create PR using the GitHub REST API via hub
34+
shell: bash
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
37+
MESSAGE_TITLE: Generated v1.0 models and request builders using Kiota
38+
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."
39+
ASSIGNEDTO: calebkiage
40+
LABELS: generated
41+
BASE: main
42+
run: |
43+
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
44+
bin/hub pull-request -b "$BASE" -h "$GITHUB_REF" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -a "$ASSIGNEDTO" -l "$LABELS"
45+
46+
# References
47+
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
48+
# [1] https://hub.github.com/hub-pull-request.1.html
49+
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token

0 commit comments

Comments
 (0)