Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
957e6d2
Initial commit
Jul 22, 2025
75a1ae8
Enhancing
Jul 22, 2025
9437195
Adding resiliency
Jul 22, 2025
a6d0399
Adding resiliency
Jul 22, 2025
d490832
Add npm-check-updates installation step and clean up Git push command
Jul 22, 2025
40b03a3
Adding resiliency
Jul 22, 2025
dfaaa60
Increasing robustness
Jul 22, 2025
e80c387
Release v1.7.5
github-actions[bot] Jul 22, 2025
ff3581e
Updating npm transitive dependencies
github-actions[bot] Jul 22, 2025
8521fbc
Fixing linting, Updating dist folder
github-actions[bot] Jul 22, 2025
2d1736a
Updating LICENSE.txt
Jul 22, 2025
2846b97
Updating packages again
Jul 23, 2025
1c9ba5c
Updating licenses
Jul 23, 2025
e23757b
Addressing feedback
Jul 23, 2025
cca38c9
Addressing feedback
Jul 23, 2025
7ab1d89
Refactor release workflows and update version handling for phases 1, …
Jul 25, 2025
cd88859
Linting
Jul 25, 2025
11c1736
Fixing linting, Updating dist folder
github-actions[bot] Jul 25, 2025
2c11dbf
Fixing Markdown linting issues
Jul 25, 2025
8ed828a
Update LICENSE.txt to reflect version changes and add missing copyrig…
Jul 25, 2025
2cc4da1
Update release-phase-2-comment.md to clarify license update steps
Jul 25, 2025
bb18136
Updating trigger linting and relocating files
Jul 25, 2025
3a31fcc
Refactor GitHub Actions: Remove obsolete workflows and implement new …
Jul 25, 2025
0eab450
Refactor release workflow: Remove obsolete checkout token input and r…
Jul 28, 2025
04d8d61
Update release job name and fix token reference in release-phase-1.yml
Jul 28, 2025
fa34bf7
Fix token reference for release PR creation in release-phase-1.yml
Jul 28, 2025
34ef2d2
Remove obsolete permissions for contents in release job
Jul 28, 2025
7326076
Reverting changes
Jul 28, 2025
2d9343b
Fix environment variable name for GitHub token in PR creation step
Jul 28, 2025
7b7faf0
Fix GitHub token reference for PR creation in release-phase-1-interna…
Jul 28, 2025
97db26e
Refactor Git setup and push steps in release-phase-1-internal.yml
Jul 28, 2025
c08f357
Refactor Git steps to use default shell for authentication and config…
Jul 28, 2025
ecdee3c
Remove assignee and reviewer from PR creation step in release-phase-1…
Jul 28, 2025
1709431
Refactor release workflows to use internal action and update shell to…
Jul 28, 2025
6d2883d
Update shell to PowerShell for Git setup and push steps; simplify npm…
Jul 28, 2025
1729e6d
Update Git commands to remove quotes around branch names and bump dep…
Jul 28, 2025
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ indent_size = unset
[*.{copyproj,resjson}]
indent_size = 2

[.github/workflows/support/release-trigger.txt]
[.github/workflows/support/release-phase-*-trigger.txt]
insert_final_newline = unset

[src/LICENSE.txt]
Expand Down
54 changes: 54 additions & 0 deletions .github/actions/git-setup-and-push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

---
name: Git Setup & Push
description: Sets up git configuration and pushes changes to a release branch

inputs:
phase:
description: Release phase number
required: true
version:
description: Version string for the release
required: true
github-token:
description: GitHub token for authentication
required: true

runs:
using: composite
steps:
- name: Git – Setup Authentication
shell: pwsh
run: gh auth setup-git
env:
GITHUB_TOKEN: ${{ inputs.github-token }}

- name: Git – Set Name
shell: pwsh
run: git config --global user.name "github-actions[bot]"

- name: Git – Set Email
shell: pwsh
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Git – Set Merge Strategy
shell: pwsh
run: git config pull.rebase false

- name: Git – Create Branch
shell: pwsh
run: git checkout -b release/v${{ inputs.version }}-phase-${{ inputs.phase }}

- name: Git – Add Changed Files
shell: pwsh
run: git add -A

- name: Git – Commit Changed Files
shell: pwsh
run: git commit -m "Release v${{ inputs.version }}"

- name: Git – Push Changed Files
shell: pwsh
run: git push --set-upstream origin release/v${{ inputs.version }}-phase-${{ inputs.phase }}
185 changes: 185 additions & 0 deletions .github/actions/release-phase-1-internal/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

---
name: Release – Phase 1 (Internal)
description: Internal action for Release Phase 1 that handles version updates and creates PR

inputs:
major:
description: Major version number
required: true
minor:
description: Minor version number
required: true
patch:
description: Patch version number
required: true
github-token:
description: GitHub token for API access
required: true
release-pr-create-token:
description: Token for creating pull requests
required: true

runs:
using: composite
steps:
- name: Validate major
shell: pwsh
run: "[int]::Parse(${{ inputs.major }})"

- name: Validate minor
shell: pwsh
run: "[int]::Parse(${{ inputs.minor }})"

- name: Validate patch
shell: pwsh
run: "[int]::Parse(${{ inputs.patch }})"

- name: Set version environment variable
shell: bash
run: echo "version=${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}" >> $GITHUB_ENV

- name: Version Number – README.md
shell: pwsh
run: |-
$FilePath = 'README.md'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace 'PR-Metrics@v\d+\.\d+\.\d+', 'PR-Metrics@v${{ env.version }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – package.json
shell: pwsh
run: |-
$FilePath = 'package.json'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace '"version": "\d+\.\d+\.\d+"', '"version": "${{ env.version }}"'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – vss-extension.json
shell: pwsh
run: |-
$FilePath = 'src/vss-extension.json'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace '"version": "\d+\.\d+\.\d+"', '"version": "${{ env.version }}"'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – release-phase-2-trigger.txt
shell: pwsh
run: Set-Content -Path '.github/workflows/support/release-phase-2-trigger.txt' -Value ${{ env.version }}

- name: Version Number – task.json
shell: pwsh
run: |-
$FilePath = 'src/task/task.json'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace 'PR Metrics v\d+\.\d+\.\d+', 'PR Metrics v${{ env.version }}'
$FileContents = $FileContents -replace '"Major": \d+', '"Major": ${{ inputs.major }}'
$FileContents = $FileContents -replace '"Minor": \d+', '"Minor": ${{ inputs.minor }}'
$FileContents = $FileContents -replace '"Patch": \d+', '"Patch": ${{ inputs.patch }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – task.loc.json
shell: pwsh
run: |-
$FilePath = 'src/task/task.loc.json'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace '"Major": \d+', '"Major": ${{ inputs.major }}'
$FileContents = $FileContents -replace '"Minor": \d+', '"Minor": ${{ inputs.minor }}'
$FileContents = $FileContents -replace '"Patch": \d+', '"Patch": ${{ inputs.patch }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – resources.resjson
shell: pwsh
run: |-
$FilePath = 'src/task/Strings/resources.resjson/en-US/resources.resjson'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace 'PR Metrics v\d+\.\d+\.\d+', 'PR Metrics v${{ env.version }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – gitHubReposInvoker.ts
shell: pwsh
run: |-
$FilePath = 'src/task/src/repos/gitHubReposInvoker.ts'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace 'PRMetrics\/v\d+\.\d+\.\d+', 'PRMetrics/v${{ env.version }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – gitHubReposInvoker.spec.ts
shell: pwsh
run: |-
$FilePath = 'src/task/tests/repos/gitHubReposInvoker.spec.ts'
$FileContents = Get-Content -Path $FilePath
$FileContents = $FileContents -replace 'PRMetrics\/v\d+\.\d+\.\d+', 'PRMetrics/v${{ env.version }}'
Set-Content -Path $FilePath -Value $FileContents

- name: Version Number – Increment Patch
id: increment-patch
shell: pwsh
run: |-
$IncrementedPatch = [int]::Parse(${{ inputs.patch }}) + 1
Write-Output -InputObject "INCREMENTED_PATCH=$IncrementedPatch" >> $Env:GITHUB_OUTPUT

- name: Version Number – release-phase-1.yml
shell: pwsh
run: |-
$FilePath = '.github/workflows/release-phase-1.yml'
$FileContents = Get-Content -Raw $FilePath
$FileContents = $FileContents -replace '(?<Yaml>major: )\d+', '${Yaml}${{ inputs.major }}'
$FileContents = $FileContents -replace '(?<Yaml>minor: )\d+', '${Yaml}${{ inputs.minor }}'
$FileContents = $FileContents -replace '(?<Yaml>patch: )\d+', '${Yaml}${{ steps.increment-patch.outputs.INCREMENTED_PATCH }}'
Set-Content -Path $FilePath -Value $FileContents.Substring(0, $FileContents.Length - 1) # Remove the trailing newline.

- name: Git Setup & Push
uses: ./.github/actions/git-setup-and-push
with:
phase: 1
version: ${{ env.version }}
github-token: ${{ inputs.github-token }}

- name: PR – Create
shell: pwsh
run: >-
gh pr create
--title "[Autogenerated] Release v${{ env.version }}"
--body "Autogenerated release for PR Metrics v${{ env.version }}. This includes the latest dependency updates."
--label "release"
env:
# Fine-grained Personal Access Token (PAT) with the following permissions for microsoft/PR-Metrics:
# - Read access to Metadata
# - Read and Write access to Pull Requests
GITHUB_TOKEN: ${{ inputs.release-pr-create-token }}

- name: npm – Install Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20.17.0

- name: npm – Install
shell: pwsh
run: npm install

- name: npm – Update Dependencies
shell: pwsh
run: npx ncu -u

- name: npm – Update Transitive Dependencies
shell: pwsh
run: npm update

- name: Git – Add Changed Files
shell: pwsh
run: git add -A

- name: Git – Commit Changed Files
shell: pwsh
run: git commit -m "Updating dependencies"

- name: Git – Pull Changed Files
shell: pwsh
run: git pull

- name: Git – Push Changed Files
shell: pwsh
run: git push --set-upstream origin release/v${{ env.version }}-phase-1
Loading
Loading