-
Notifications
You must be signed in to change notification settings - Fork 514
Added the split method for labeler workflow #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ronitsabhaya75
wants to merge
15
commits into
apple:main
Choose a base branch
from
Ronitsabhaya75:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−0
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
752571b
Implement automated PR labeling with security-focused split workflows
Ronitsabhaya75 82f6a3a
Updated auto-labeling workflows with color-coded labels
Ronitsabhaya75 f59657e
Fix: Use native git commands instead of blocked third-party action
Ronitsabhaya75 9e02130
updating the typos
Ronitsabhaya75 9623b30
updating the files for CLI only
Ronitsabhaya75 30e9ab1
Refactor to use actions/labeler@v5 with PR number from artifact per K…
Ronitsabhaya75 2ddaa14
removed unessacry checkout
Ronitsabhaya75 a95cf4f
deleted the color labels file
Ronitsabhaya75 89d0389
reverted the checkout steps
Ronitsabhaya75 48f8a2c
Merge branch 'main' into main
Ronitsabhaya75 6b294f2
Merge branch 'main' into main
Ronitsabhaya75 6bdb672
Merge branch 'main' into main
Ronitsabhaya75 b1cfc07
Merge branch 'main' into main
Ronitsabhaya75 fca022a
Merge branch 'main' into main
Ronitsabhaya75 6728665
Merge branch 'main' into main
Ronitsabhaya75 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cli: | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - 'Sources/CLI/**' | ||
| - 'Sources/ContainerCommands/**' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: PR Label Analysis | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze PR for labeling | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Save PR metadata | ||
| run: | | ||
| mkdir -p ./pr-metadata | ||
| echo "${{ github.event.pull_request.number }}" > ./pr-metadata/pr-number.txt | ||
|
|
||
| - name: Upload PR metadata as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: pr-metadata-${{ github.event.pull_request.number }} | ||
| path: pr-metadata/ | ||
| retention-days: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: PR Label Apply | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["PR Label Analysis"] | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| apply-labels: | ||
| name: Apply labels to PR | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Download PR metadata artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| pattern: pr-metadata-* | ||
| merge-multiple: false | ||
| continue-on-error: true | ||
| id: download-artifact | ||
|
|
||
| - name: Read PR number | ||
| id: pr-number | ||
| run: | | ||
| METADATA_DIR=$(find . -type d -name "pr-metadata-*" 2>/dev/null | head -n 1) | ||
|
|
||
| if [ -z "$METADATA_DIR" ]; then | ||
| echo "No metadata found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| PR_NUMBER=$(cat "${METADATA_DIR}/pr-number.txt") | ||
| echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
| echo "PR Number: ${PR_NUMBER}" | ||
|
|
||
| - name: Apply labels using labeler | ||
| uses: actions/labeler@v5 | ||
| with: | ||
| pr-number: ${{ steps.pr-number.outputs.number }} | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| configuration-path: .github/labeler.yml | ||
| sync-labels: true | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have checked out the repo to access this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need to checkout the repository to access the .github/labeler.yml configuration file. Without checkout, the workflow runner won't have access to any files from the repo, including the labeler configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the repo being checked out in this workflow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I accidentally removed it let me add it again. Thank you Katie for pointing that out.