-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(github): point to ref/repo from PR HEAD, add/remove labels #10
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: github-add-label | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
PRIMUS_REF: | ||
description: 'The primus ref to checkout.' | ||
required: true | ||
default: 'main' | ||
type: string | ||
GITHUB_LABEL_NAME: | ||
description: 'The name of the label to add.' | ||
required: true | ||
type: string | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
PRIMUS_HOME: .primus | ||
MAKE: make --no-print-directory --makefile=.primus/src/make/main.mk | ||
|
||
jobs: | ||
signoz: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
steps: | ||
- name: self-checkout | ||
uses: actions/checkout@v4 | ||
- id: token | ||
name: github-token-gen | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.PRIMUS_APP_ID }} | ||
private-key: ${{ secrets.PRIMUS_PRIVATE_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
- name: primus-checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: signoz/primus | ||
ref: ${{ inputs.PRIMUS_REF }} | ||
path: .primus | ||
token: ${{ steps.token.outputs.token }} | ||
- name: info | ||
run: | | ||
$MAKE info | ||
- name: add-label | ||
env: | ||
GH_REPOSITORY: ${{ github.repository }} | ||
GH_ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
GH_LABEL_NAME: ${{ inputs.GITHUB_LABEL_NAME }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification The workflow needs context validation or parameter adjustment The workflow is designed as a reusable workflow (
Consider either:
🔗 Analysis chainVerify issue number availability in event context. The workflow assumes 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check if the workflow is used in any other workflow files
# to understand the trigger contexts
echo "Checking workflow usage contexts..."
rg -l "uses: ./.github/workflows/github-add-label.yaml" .
Length of output: 140 Script: #!/bin/bash
# First, let's look at the workflow file content
echo "=== Workflow File Content ==="
cat .github/workflows/github-add-label.yaml
echo -e "\n=== Searching for workflow references with different patterns ==="
rg -l "github-add-label" .
echo -e "\n=== Looking for workflow files that might use this ==="
fd "workflow" .github/
Length of output: 2060 Script: #!/bin/bash
# Search for workflow files that might call this workflow
echo "=== Searching for workflow calls ==="
rg -l "workflow.*github-add-label" .github/workflows/
# Look for the actual workflow call pattern
echo -e "\n=== Searching for specific workflow call patterns ==="
rg "uses:.*github-add-label" .github/workflows/
Length of output: 311 |
||
run: | | ||
$MAKE github-add-label \ | ||
GITHUB_ARGS="-t ${{ steps.token.outputs.token }} \ | ||
-r ${GH_REPOSITORY} \ | ||
-i ${GH_ISSUE_NUMBER} \ | ||
-l '${GH_LABEL_NAME}'" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: github-remove-label | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
PRIMUS_REF: | ||
description: 'The primus ref to checkout.' | ||
required: true | ||
default: 'main' | ||
type: string | ||
GITHUB_LABEL_NAME: | ||
description: 'The name of the label to remove.' | ||
required: true | ||
type: string | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
PRIMUS_HOME: .primus | ||
MAKE: make --no-print-directory --makefile=.primus/src/make/main.mk | ||
|
||
jobs: | ||
signoz: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
steps: | ||
- name: self-checkout | ||
uses: actions/checkout@v4 | ||
- id: token | ||
name: github-token-gen | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.PRIMUS_APP_ID }} | ||
private-key: ${{ secrets.PRIMUS_PRIVATE_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
- name: primus-checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: signoz/primus | ||
ref: ${{ inputs.PRIMUS_REF }} | ||
path: .primus | ||
token: ${{ steps.token.outputs.token }} | ||
- name: info | ||
run: | | ||
$MAKE info | ||
- name: remove-label | ||
env: | ||
GH_REPOSITORY: ${{ github.repository }} | ||
GH_ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
GH_LABEL_NAME: ${{ inputs.GITHUB_LABEL_NAME }} | ||
run: | | ||
$MAKE github-remove-label \ | ||
GITHUB_ARGS="-t ${{ steps.token.outputs.token }} \ | ||
-r ${GH_REPOSITORY} \ | ||
-i ${GH_ISSUE_NUMBER} \ | ||
-l '${GH_LABEL_NAME}'" |
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.
🛠️ Refactor suggestion
Remove default value for required input.
The
PRIMUS_REF
input is marked as required but also has a default value. This is redundant as the default value will never be used for required inputs.PRIMUS_REF: description: 'The primus ref to checkout.' required: true - default: 'main' type: string
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
9-9: input "PRIMUS_REF" of workflow_call event has the default value "main", but it is also required. if an input is marked as required, its default value will never be used
(events)