Skip to content

Commit 30ba997

Browse files
authored
fix: auto-add.yml - fix invalid project URL, use vars.GITHUB_PROJECT_URL + add guard condition
- Replace hardcoded YOUR_PROJECT_NUMBER placeholder with repo variable - Add if: condition to skip job when project URL not configured - Upgrade to actions/add-to-project@v0.6.1 - Use ${{ secrets.PROJECT_TOKEN || github.token }} for flexible auth Fixes 'Invalid project URL' error on all PRs Signed-off-by: rigoryanych <rigoryanych1397@gmail.com>
1 parent 0b1b9d1 commit 30ba997

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

.github/workflows/auto-add.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Auto-add issues to project
22

3-
# NOTE: Before using this workflow, you need to:
4-
# 1. Replace the project-url with your actual GitHub project URL
5-
# 2. Create a PAT with project permissions and store it as a repository secret named PROJECT_TOKEN
6-
# OR use the alternate approach below with GITHUB_TOKEN (has limited permissions)
3+
# SETUP REQUIRED: Before using this workflow, set a repository variable GITHUB_PROJECT_URL
4+
# Go to Settings > Secrets and variables > Actions > Variables
5+
# Add variable: GITHUB_PROJECT_URL = https://github.com/users/romanchaa997/projects/<NUMBER>
6+
# Then create project at: https://github.com/users/romanchaa997/projects
77

88
on:
99
issues:
@@ -19,16 +19,11 @@ jobs:
1919
add-to-project:
2020
name: Add issue to project
2121
runs-on: ubuntu-latest
22+
# Only run if project URL is configured
23+
if: vars.GITHUB_PROJECT_URL != '' && vars.GITHUB_PROJECT_URL != null
2224
steps:
23-
- uses: actions/add-to-project@v0.5.0
25+
- uses: actions/add-to-project@v0.6.1
2426
with:
25-
# Replace with your actual project URL
26-
project-url: https://github.com/users/romanchaa997/projects/YOUR_PROJECT_NUMBER
27-
# Option 1: Use a dedicated PAT with project permissions (preferred for org projects)
28-
# github-token: ${{ secrets.PROJECT_TOKEN }}
29-
# Option 2: Use the default token (works for personal projects, has limitations)
30-
github-token: ${{ github.token }}
31-
# Optional: Configure conditional to only add specific issues
32-
# labeled-fields-as-options: true
33-
# label-operator: OR
34-
# label-prefix: area:
27+
project-url: ${{ vars.GITHUB_PROJECT_URL }}
28+
github-token: ${{ secrets.PROJECT_TOKEN || github.token }}
29+
continue-on-error: true

0 commit comments

Comments
 (0)