-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub action for weekly preview OpenAPI docs refresh PR. (#1617)
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.github/workflows/create-preview-openapidocs-pr-workflow.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "[email protected]" | ||
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 |