-
Notifications
You must be signed in to change notification settings - Fork 0
Ci/add to project #32
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
base: main
Are you sure you want to change the base?
Changes from all 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,38 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Add to project | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| issues: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| add-to-project: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Add to project | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/add-to-project@v1.0.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| project-url: https://github.com/orgs/evstack/projects/7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Set Area to devx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ITEM_ID: ${{ steps.add.outputs.itemId }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Get the field and option IDs for Area=devx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PROJECT_ID=$(gh project list --owner evstack --format json \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | jq -r '.projects[] | select(.number==7) | .id') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FIELD_ID=$(gh project field-list "$PROJECT_ID" --owner evstack --format json \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | jq -r '.fields[] | select(.name=="Area") | .id') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OPTION_ID=$(gh project field-list "$PROJECT_ID" --owner evstack --format json \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | jq -r '.fields[] | select(.name=="Area") | .options[] | select(.name=="devx") | .id') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh project item-edit \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --owner evstack \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --project-number 7 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --id "$ITEM_ID" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --field-id "$FIELD_ID" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --single-select-option-id "$OPTION_ID" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+22
to
+38
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. Add empty-variable guards to surface actionable errors.
🛡️ Proposed fix — add guards after each ID resolution PROJECT_ID=$(gh project list --owner evstack --format json \
| jq -r '.projects[] | select(.number==7) | .id')
+ [ -z "$PROJECT_ID" ] && { echo "Error: project 7 not found"; exit 1; }
FIELD_ID=$(gh project field-list "$PROJECT_ID" --owner evstack --format json \
| jq -r '.fields[] | select(.name=="Area") | .id')
+ [ -z "$FIELD_ID" ] && { echo "Error: 'Area' field not found"; exit 1; }
- OPTION_ID=$(gh project field-list "$PROJECT_ID" --owner evstack --format json \
+ OPTION_ID=$(gh project field-list "$PROJECT_ID" --owner evstack --format json \ # reuse cached output — see refactor comment
| jq -r '.fields[] | select(.name=="Area") | .options[] | select(.name=="devx") | .id')
+ [ -z "$OPTION_ID" ] && { echo "Error: 'devx' option not found in 'Area' field"; exit 1; }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+33
to
+38
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. 🧩 Analysis chain🌐 Web query:
💡 Result: Official docs for It lists these flags/options (among others): Citations:
The 🐛 Proposed fix gh project item-edit \
- --owner evstack \
- --project-number 7 \
--id "$ITEM_ID" \
+ --project-id "$PROJECT_ID" \
--field-id "$FIELD_ID" \
--single-select-option-id "$OPTION_ID"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/add-to-project.yml | head -20Repository: evstack/ev-metrics
Length of output: 642
🏁 Script executed:
Repository: evstack/ev-metrics
Length of output: 44
🌐 Web query:
actions/add-to-project v1.0.2 commit SHA github💡 Result:
actions/add-to-project@v1.0.2resolves to commit SHA:244f685bbc3b7adfa8466e08b698b5577571133e[1]🌐 Web query:
actions/add-to-project v1.0.2 release tag github 244f685bbc3b7adfa8466e08b698b5577571133e💡 Result:
The
actions/add-to-projectv1.0.2GitHub release/tag points to commit244f685bbc3b7adfa8466e08b698b5577571133e(short SHA244f685). The release was published June 24, 2024. [1][2]🌐 Web query:
actions/add-to-project releases page v1.0.2 commit💡 Result:
actions/add-to-project@v1.0.2points to commit 244f685bbc3b7adfa8466e08b698b5577571133e (short SHA 244f685). [1][2]Sources:
[1] https://github.com/actions/add-to-project/releases
[2] actions/add-to-project@244f685
Pin
actions/add-to-projectto a full commit SHA.Release tags are mutable and a malicious actor can override them. Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release.
🔒 Proposed fix — pin to commit SHA with tag comment
📝 Committable suggestion
🤖 Prompt for AI Agents