Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/create-preview-openapidocs-pr-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This is a basic workflow to help you get started with Actions

name: "Create Weekly Preview OpenAPI Docs Refresh PR"
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches:
- 'WeeklyPreviewRefresh/*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
createOpenApiDocsPR:
if: github.event_name == 'push' && contains(toJson(github.event.commits), '[run ci]') && !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
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Configure User
run: |
git config --global user.email "GraphTooling@service.microsoft.com"
git config --global user.name "Microsoft Graph DevX Tooling"

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2

- name: List Directory
run: |
echo $GITHUB_WORKSPACE
ls -lsa $GITHUB_WORKSPACE
ls -lsa $GITHUB_WORKSPACE/tools

# 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: Weekly Preview OpenAPI Docs Refresh
MESSAGE_BODY: "This pull request was automatically created by the GitHub Action,\n\n Contains OpenApi Docs Updates from Graph Explorer API (DevX API)"
REVIEWERS: peombwa,ddyett,timayabi2020,mairissi,shemogumbe
ASSIGNEDTO: peombwa
LABELS: generated
BASE: dev
HEAD: ${{steps.create_branch.outputs.branch}}
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -b "$BASE" -h "$HEAD" -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