Skip to content

Commit

Permalink
Merge pull request Azure#9893 from Azure/fix-pipeline-issues
Browse files Browse the repository at this point in the history
Improvements as per Github new change
  • Loading branch information
v-amolpatil authored Feb 9, 2024
2 parents 5de746d + f5e87c2 commit c5f8d3d
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 21 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/AddLabel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
paths:
- Solutions/**

env:
GITHUB_APPS_ID: "${{ secrets.APPLICATION_ID }}"
GITHUB_APPS_KEY: "${{ secrets.APPLICATION_PRIVATE_KEY }}"

jobs:
solutionNameDetails:
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork && !contains(github.event.pull_request.labels.*.name, 'P0')}}
Expand All @@ -27,9 +31,19 @@ jobs:
needs: solutionPublisherDetail
if: ${{ github.actor != 'dependabot[bot]' && needs.solutionPublisherDetail.outputs.solutionPublisherId != '' && !contains(fromJson(vars.INTERNAL_PUBLISHERS),needs.solutionPublisherDetail.outputs.solutionPublisherId) }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9
with:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- name: Add Label Notification
uses: actions/github-script@v6
uses: actions/github-script@b7fb2001b410c9390cbe9e2c7d5cab7eefb7b29c
env:
APPTOKEN: ${{ steps.generate_token.outputs.token }}
with:
github-token: ${{ env.APPTOKEN }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
Expand Down
25 changes: 21 additions & 4 deletions .github/workflows/IssueComment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,30 @@ on:
issues:
types: opened

env:
GITHUB_APPS_ID: "${{ secrets.APPLICATION_ID }}"
GITHUB_APPS_KEY: "${{ secrets.APPLICATION_PRIVATE_KEY }}"

jobs:
commenting:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9
with:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/github-script@b7fb2001b410c9390cbe9e2c7d5cab7eefb7b29c
env:
APPTOKEN: ${{ steps.generate_token.outputs.token }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ env.APPTOKEN }}
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
github.issues.createComment({ issue_number, owner, repo, body: 'Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.' });
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.'
});
15 changes: 14 additions & 1 deletion .github/workflows/addComment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ on:
required: false
type: string

env:
GITHUB_APPS_ID: "${{ secrets.APPLICATION_ID }}"
GITHUB_APPS_KEY: "${{ secrets.APPLICATION_PRIVATE_KEY }}"

jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@29423367f079522048aa7c63f671593b0556ffd5
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9
with:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/github-script@b7fb2001b410c9390cbe9e2c7d5cab7eefb7b29c
env:
MESSAGE: ${{ inputs.message}}
PR_NUMBER: ${{ inputs.prNumber }}
APPTOKEN: ${{ steps.generate_token.outputs.token }}
with:
github-token: ${{ env.APPTOKEN }}
script: |
$prNumber = process.env.PR_NUMBER
$prNumber = $prNumber ? $prNumber : context.issue.number
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/addLabelOnPr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,28 @@ on:
required: true
type: string

env:
GITHUB_APPS_ID: "${{ secrets.APPLICATION_ID }}"
GITHUB_APPS_KEY: "${{ secrets.APPLICATION_PRIVATE_KEY }}"

jobs:
addLabelOnPR:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@29423367f079522048aa7c63f671593b0556ffd5
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@46e4a501e119d39574a54e53a06c9a705efc55c9
with:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/github-script@b7fb2001b410c9390cbe9e2c7d5cab7eefb7b29c
name: Add Label To Pull Request
env:
APPTOKEN: ${{ steps.generate_token.outputs.token }}
with:
github-token: ${{ env.APPTOKEN }}
script: |
$labelName = "${{ inputs.labelName }}"
console.log('PR Number : ' + context.issue.number + ', LabelName ' + $labelName)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/arm-ttk-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
mainTemplateChanged: ${{ steps.step1.outputs.mainTemplateChanged }}
createUiChanged: ${{ steps.step1.outputs.createUiChanged }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0
- shell: pwsh
Expand All @@ -21,7 +21,7 @@ jobs:
Install-Module powershell-yaml
./.script/package-automation/arm-ttk-tests.ps1
- uses: docker/build-push-action@v2
- uses: docker/build-push-action@4976231911ebf5f32aad765192d35f942aa48cb8
id: publishGithubPackage
name: Run ARM-TTK
if: ${{ success() && steps.step1.outcome == 'success' && steps.step1.outputs.solutionName != '' && (steps.step1.outputs.mainTemplateChanged == 'true' || steps.step1.outputs.createUiChanged == 'true') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkPRContentChange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
outputs:
hasContentPackageChange: ${{ steps.changesInPR.outputs.hasContentPackageChange }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 2
ref: "${{ env.BRANCH_NAME }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkSkipPackagingInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
outputs:
isPackagingRequired: ${{ steps.getPackagingSkipStatus.outputs.isPackagingRequired }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 2
ref: "${{ env.BRANCH_NAME }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/getSolutionName.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
outputs:
sName: "${{ steps.getSolutionName.outputs.solutionName }}"
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 2
ref: "${{ env.BRANCH_NAME }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/neworexistingsolution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
solutionOfferId: "${{ steps.IdentifyNewOrExistingSolution.outputs.solutionOfferId }}"
solutionPublisherId: "${{ steps.IdentifyNewOrExistingSolution.outputs.solutionPublisherId }}"
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 2
ref: ${{ env.BRANCH_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
env:
GeneratedToken: ${{ steps.generate_token.outputs.token }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-on-fork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
env:
GeneratedToken: ${{ steps.generate_token.outputs.token }}
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/package-on-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
app-id: ${{ env.GITHUB_APPS_ID }}
private-key: ${{ env.GITHUB_APPS_KEY }}

- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
env:
GeneratedToken: ${{ steps.generate_token.outputs.token }}
with:
Expand All @@ -42,12 +42,12 @@ jobs:
BranchName: ${{ github.event.pull_request.head.ref }}
shell: pwsh
run: |
$forkPRBranchName = "$env:BranchName"
Write-Host "Fork Branch Name is $forkPRBranchName"
$PRBranchName = "$env:BranchName"
Write-Host "Branch Name is $PRBranchName"
$isAutomatedPR = $false
if ($forkPRBranchName -like '*automated-pr')
if ($PRBranchName -like '*automated-pr')
{
Write-Host "Skipping packaging as it is an automated fork pr!"
Write-Host "Skipping packaging as it is an automated pr!"
$isAutomatedPR = $true
}
Write-Output "isAutomatedPR=$isAutomatedPR" >> $env:GITHUB_OUTPUT
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:

- name: createNewPR
id: createNewPR
if: ${{ success() }}
if: ${{ success() && steps.uploadDataFileArtifact.outcome == 'success' }}
uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5
env:
SOLUTION_NAME: "${{ steps.validateAndCreatePackage.outputs.solutionName }}"
Expand Down

0 comments on commit c5f8d3d

Please sign in to comment.