Skip to content

Update setup-repo.yml #3

Update setup-repo.yml

Update setup-repo.yml #3

Workflow file for this run

name: Assign Topics Automatically

Check failure on line 1 in .github/workflows/setup-repo.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/setup-repo.yml

Invalid workflow file

(Line: 15, Col: 7): Unexpected value 'metadata'
on:
push:
branches: [main]
# This ensures it runs only once after repo is created with initial push
jobs:
assign-topics:
runs-on: ubuntu-latest
permissions:
contents: read
repository-projects: write
metadata: write
steps:
- name: Extract Repo Info
id: extract
run: |
REPO="${GITHUB_REPOSITORY##*/}"
echo "Full Repo Name: $REPO"
IFS='_' read -r INSTITUTE DEPT COURSE PROJECT SECTION TEAM <<< "$REPO"
echo "institute=$INSTITUTE" >> $GITHUB_OUTPUT
echo "department=$DEPT" >> $GITHUB_OUTPUT
echo "course=$COURSE" >> $GITHUB_OUTPUT
echo "project=$PROJECT" >> $GITHUB_OUTPUT
echo "section=$SECTION" >> $GITHUB_OUTPUT
echo "team_id=$TEAM" >> $GITHUB_OUTPUT
- name: Set Topics via GitHub API
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/${{ github.repository }} \
--method PUT \
-H "Accept: application/vnd.github.mercy-preview+json" \
-f name='${{ github.event.repository.name }}' \
-f description='Auto-tagged repository for ${{ steps.extract.outputs.project }} project' \
-F topics='${{ steps.extract.outputs.institute }},${{ steps.extract.outputs.department }},${{ steps.extract.outputs.course }},${{ steps.extract.outputs.project }},${{ steps.extract.outputs.section }},${{ steps.extract.outputs.team_id }}'