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

Commit 883c3e6

Browse files
committed
- adds additional workflows for repository
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
1 parent 25c3c59 commit 883c3e6

File tree

4 files changed

+185
-0
lines changed

4 files changed

+185
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: PullRequestConflicting
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
types: [synchronize]
12+
branches: [ main ]
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
build:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
21+
# Steps represent a sequence of tasks that will be executed as part of the job
22+
steps:
23+
- name: check if prs are dirty
24+
uses: eps1lon/actions-label-merge-conflict@releases/2.x
25+
if: env.LABELING_TOKEN != '' && env.LABELING_TOKEN != null
26+
id: check
27+
with:
28+
dirtyLabel: "conflicting"
29+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
30+
continueOnMissingPermissions: true
31+
commentOnDirty: 'This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.'
32+
commentOnClean: 'Conflicts have been resolved. A maintainer will take a look shortly.'
33+
env:
34+
LABELING_TOKEN: ${{secrets.GITHUB_TOKEN }}
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 master 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/checkout@v3
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: baywet
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

.github/workflows/git-release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Git Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
9+
jobs:
10+
Git_Release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Github Release
15+
uses: anton-yurchenko/git-release@v5.0
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
18+
DRAFT_RELEASE: "false"
19+
PRE_RELEASE: "false"
20+
CHANGELOG_FILE: "CHANGELOG.md"
21+
ALLOW_EMPTY_CHANGELOG: "true"

.github/workflows/projectsbot.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This workflow is used to add new issues to GitHub Projects (Beta)
2+
3+
name: Add PR to project
4+
on:
5+
issues:
6+
types: [opened]
7+
jobs:
8+
track_issue:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Generate token
12+
id: generate_token
13+
uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c
14+
with:
15+
app_id: ${{ secrets.GRAPHBOT_APP_ID }}
16+
private_key: ${{ secrets.GRAPHBOT_APP_PEM }}
17+
18+
- name: Get project data
19+
env:
20+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
21+
ORGANIZATION: microsoftgraph
22+
PROJECT_NUMBER: 38
23+
run: |
24+
gh api graphql -f query='
25+
query($org: String!, $number: Int!) {
26+
organization(login: $org){
27+
projectNext(number: $number) {
28+
id
29+
fields(first:20) {
30+
nodes {
31+
id
32+
name
33+
settings
34+
}
35+
}
36+
}
37+
}
38+
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
39+
40+
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
41+
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
42+
echo 'TRIAGE_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Needs Triage 🔍") |.id' project_data.json) >> $GITHUB_ENV
43+
44+
- name: Add Issue to project
45+
env:
46+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
47+
ISSUE_ID: ${{ github.event.issue.node_id }}
48+
run: |
49+
item_id="$( gh api graphql -f query='
50+
mutation($project:ID!, $issue:ID!) {
51+
addProjectNextItem(input: {projectId: $project, contentId: $issue}) {
52+
projectNextItem {
53+
id
54+
}
55+
}
56+
}' -f project=$PROJECT_ID -f issue=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
57+
58+
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
59+
60+
- name: Set Triage
61+
env:
62+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
63+
run: |
64+
gh api graphql -f query='
65+
mutation (
66+
$project: ID!
67+
$item: ID!
68+
$status_field: ID!
69+
$status_value: String!
70+
) {
71+
set_status: updateProjectNextItemField(input: {
72+
projectId: $project
73+
itemId: $item
74+
fieldId: $status_field
75+
value: $status_value
76+
}) {
77+
projectNextItem {
78+
id
79+
}
80+
}
81+
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TRIAGE_OPTION_ID }} --silent

0 commit comments

Comments
 (0)