Skip to content

Commit

Permalink
[release-v2.7] adding paths filtering code to validation-check (#3499)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasSUSE authored Mar 4, 2024
1 parent 03d6aa1 commit b849ecb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout base branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout PR
run: gh pr checkout ${{ github.event.pull_request.number }}
Expand All @@ -28,22 +28,22 @@ jobs:
- name: Check release.yaml
run: sudo make check-release-yaml

- name: Validate
- name: Validate
run: sudo make validate

check-images:
name: Check Container Images
runs-on: ubuntu-latest
steps:
- name: Checkout base branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout PR
run: gh pr checkout ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check container images
- name: Check container images
run: make check-images
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout base branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout PR
run: gh pr checkout ${{ github.event.pull_request.number }}
Expand All @@ -70,12 +70,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout base branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout PR
run: gh pr checkout ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Hull tests
run: cd tests && go test -v ./...
run: cd tests && go test -v ./...
12 changes: 6 additions & 6 deletions .github/workflows/regsync-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generate-Regsync-Config action will run for every PR into release-v2.7 branch only after an approval is given
# It will run make target to generate regsync file and add a commit to the PR updating the regsync file.
# Generate-Regsync-Config action will run for every PR into release-v2.7 branch only after an approval is given
# It will run make target to generate regsync file and add a commit to the PR updating the regsync file.
# It will then install and run regsync client and do the prime image mirroring.

name: Generate-Regsync-Config
Expand Down Expand Up @@ -33,10 +33,10 @@ jobs:
if: needs.onLabelAndApproval.outputs.is_approved == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PUSH_TOKEN }}
token: ${{ secrets.PUSH_TOKEN }}

- name: Set-up Ruby 3.2
uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -84,4 +84,4 @@ jobs:
env:
REGISTRY_ENDPOINT: ${{ secrets.REGISTRY_ENDPOINT }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
25 changes: 22 additions & 3 deletions .github/workflows/validation-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,32 @@ jobs:
if: startsWith(github.event.pull_request.base.ref, 'dev-v') || startsWith(github.event.pull_request.base.ref, 'release-v')
runs-on: ubuntu-latest
steps:
- name: Check for modifications in specified folders
id: check-modifications
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// Get the list of files modified in the PR
const files = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
// Check if any of the modified files are in the specified folders
const modifiedSpecifiedFolders = files.data.some(file => file.filename.startsWith('assets/') || file.filename.startsWith('charts/') || file.filename.startsWith('packages/'));
return modifiedSpecifiedFolders;
- name: Check for positive reaction on bot's latest validation comment
uses: actions/github-script@v4
if: steps.check-modifications.outputs.result == 'true'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
// Get comments on the PR
const comments = await github.issues.listComments({
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
Expand All @@ -29,7 +48,7 @@ jobs:
const latestValidationComment = sortedComments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.startsWith("## Validation steps"));
if (latestValidationComment) {
const reactions = await github.reactions.listForIssueComment({
const reactions = await github.rest.reactions.listForIssueComment({
comment_id: latestValidationComment.id,
owner: context.repo.owner,
repo: context.repo.repo
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validation-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
permissions: write-all
steps:
- name: Make validation comment
uses: actions/github-script@v4
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit b849ecb

Please sign in to comment.