Skip to content

Commit ac23768

Browse files
Merge pull request #24 from microsoft/psl-saswato-readme
docs: added yml and md files
2 parents 3015adb + a8c5f0a commit ac23768

File tree

6 files changed

+246
-0
lines changed

6 files changed

+246
-0
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Lines starting with '#' are comments.# Lines starting with '#' are comments.
2+
3+
# Each line is a file pattern followed by one or more owners.# Each line is a file pattern followed by one or more owners.
4+
5+
6+
7+
# These owners will be the default owners for everything in the repo.# These owners will be the default owners for everything in the repo.
8+
9+
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @Vinay-Microsoft @aniaroramsft

.github/ISSUE_TEMPLATE/subtask.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Sub task
3+
about: A sub task
4+
title: ''
5+
labels: subtask
6+
assignees: ''
7+
8+
---
9+
10+
Required by <link to parent issue>
11+
12+
# Description
13+
14+
A clear and concise description of what this subtask is.
15+
16+
# Tasks
17+
18+
_To be filled in by the engineer picking up the subtask
19+
20+
- [ ] Task 1
21+
- [ ] Task 2
22+
- [ ] ...

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Purpose
2+
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->
3+
* ...
4+
5+
## Does this introduce a breaking change?
6+
<!-- Mark one with an "x". -->
7+
8+
- [ ] Yes
9+
- [ ] No
10+
11+
<!-- Please prefix your PR title with one of the following:
12+
* `feat`: A new feature
13+
* `fix`: A bug fix
14+
* `docs`: Documentation only changes
15+
* `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
16+
* `refactor`: A code change that neither fixes a bug nor adds a feature
17+
* `perf`: A code change that improves performance
18+
* `test`: Adding missing tests or correcting existing tests
19+
* `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
20+
* `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
21+
* `chore`: Other changes that don't modify src or test files
22+
* `revert`: Reverts a previous commit
23+
* !: A breaking change is indicated with a `!` after the listed prefixes above, e.g. `feat!`, `fix!`, `refactor!`, etc.
24+
-->
25+
26+
## How to Test
27+
* Get the code
28+
29+
```
30+
git clone [repo-address]
31+
cd [repo-name]
32+
git checkout [branch-name]
33+
```
34+
35+
* Test the code
36+
<!-- Add steps to run the tests suite and/or manually test -->
37+
```
38+
```
39+
40+
## What to Check
41+
Verify that the following are valid
42+
* ...
43+
44+
## Other Information
45+
<!-- Add any other helpful information that may be needed here. -->
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Create Release"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
create-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.sha }}
21+
22+
- uses: codfish/semantic-release-action@v3
23+
id: semantic
24+
with:
25+
tag-format: 'v${version}'
26+
additional-packages: |
27+
['conventional-changelog-conventionalcommits@7']
28+
plugins: |
29+
[
30+
[
31+
"@semantic-release/commit-analyzer",
32+
{
33+
"preset": "conventionalcommits"
34+
}
35+
],
36+
[
37+
"@semantic-release/release-notes-generator",
38+
{
39+
"preset": "conventionalcommits",
40+
"presetConfig": {
41+
"types": [
42+
{ type: 'feat', section: 'Features', hidden: false },
43+
{ type: 'fix', section: 'Bug Fixes', hidden: false },
44+
{ type: 'perf', section: 'Performance Improvements', hidden: false },
45+
{ type: 'revert', section: 'Reverts', hidden: false },
46+
{ type: 'docs', section: 'Other Updates', hidden: false },
47+
{ type: 'style', section: 'Other Updates', hidden: false },
48+
{ type: 'chore', section: 'Other Updates', hidden: false },
49+
{ type: 'refactor', section: 'Other Updates', hidden: false },
50+
{ type: 'test', section: 'Other Updates', hidden: false },
51+
{ type: 'build', section: 'Other Updates', hidden: false },
52+
{ type: 'ci', section: 'Other Updates', hidden: false }
53+
]
54+
}
55+
}
56+
],
57+
'@semantic-release/github'
58+
]
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- run: echo ${{ steps.semantic.outputs.release-version }}
63+
64+
- run: echo "$OUTPUTS"
65+
env:
66+
OUTPUTS: ${{ toJson(steps.semantic.outputs) }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "PR Title Checker"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
merge_group:
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
main:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
if: ${{ github.event_name != 'merge_group' }}
19+
steps:
20+
- uses: amannn/action-semantic-pull-request@v5
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale-bot.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: "Manage Stale Issues, PRs & Unmerged Branches"
2+
on:
3+
schedule:
4+
- cron: '30 1 * * *' # Runs daily at 1:30 AM UTC
5+
workflow_dispatch: # Allows manual triggering
6+
permissions:
7+
contents: write
8+
issues: write
9+
pull-requests: write
10+
jobs:
11+
stale:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Mark Stale Issues and PRs
15+
uses: actions/stale@v9
16+
with:
17+
stale-issue-message: "This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or it will be closed in 30 days."
18+
stale-pr-message: "This PR is stale because it has been open 180 days with no activity. Please update or it will be closed in 30 days."
19+
days-before-stale: 180
20+
days-before-close: 30
21+
exempt-issue-labels: "keep"
22+
exempt-pr-labels: "keep"
23+
cleanup-branches:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0 # Fetch full history for accurate branch checks
30+
- name: Fetch All Branches
31+
run: git fetch --all --prune
32+
- name: List Merged Branches With No Activity in Last 3 Months
33+
run: |
34+
35+
echo "Branch Name,Last Commit Date,Committer,Committed In Branch,Action" > merged_branches_report.csv
36+
37+
for branch in $(git for-each-ref --format '%(refname:short) %(committerdate:unix)' refs/remotes/origin | awk -v date=$(date -d '3 months ago' +%s) '$2 < date {print $1}'); do
38+
if [[ "$branch" != "origin/main" && "$branch" != "origin/dev" ]]; then
39+
branch_name=${branch#origin/}
40+
# Ensure the branch exists locally before getting last commit date
41+
git fetch origin "$branch_name" || echo "Could not fetch branch: $branch_name"
42+
last_commit_date=$(git log -1 --format=%ci "origin/$branch_name" || echo "Unknown")
43+
committer_name=$(git log -1 --format=%cn "origin/$branch_name" || echo "Unknown")
44+
committed_in_branch=$(git branch -r --contains "origin/$branch_name" | tr -d ' ' | paste -sd "," -)
45+
echo "$branch_name,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
46+
fi
47+
done
48+
- name: List PR Approved and Merged Branches Older Than 30 Days
49+
run: |
50+
51+
for branch in $(gh api repos/${{ github.repository }}/pulls --jq '.[] | select(.merged_at != null and (.base.ref == "main" or .base.ref == "dev")) | select(.merged_at | fromdateiso8601 < (now - 2592000)) | .head.ref'); do
52+
# Ensure the branch exists locally before getting last commit date
53+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
54+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
55+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
56+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
57+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
58+
done
59+
env:
60+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
- name: List Open PR Branches With No Activity in Last 3 Months
62+
run: |
63+
64+
for branch in $(gh api repos/${{ github.repository }}/pulls --state open --jq '.[] | select(.base.ref == "main" or .base.ref == "dev") | .head.ref'); do
65+
# Ensure the branch exists locally before getting last commit date
66+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
67+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
68+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
69+
if [[ $(date -d "$last_commit_date" +%s) -lt $(date -d '3 months ago' +%s) ]]; then
70+
# If no commit in the last 3 months, mark for deletion
71+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
72+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
73+
fi
74+
done
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
- name: Upload CSV Report of Inactive Branches
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: merged-branches-report
81+
path: merged_branches_report.csv
82+
retention-days: 30

0 commit comments

Comments
 (0)