name: DSS Project Analysis # This workflow runs on every push to any branch. on: [push] jobs: dss-context-update: runs-on: ubuntu-latest steps: # Step 1: Check out the repository code - name: Checkout code uses: actions/checkout@v4 with: # We need to fetch the full history to be able to push back fetch-depth: 0 # Step 2: Set up the environment - name: Set up Environment run: | echo "Setting up Python and Node.js environment..." # Gitea's ubuntu-latest runner may not have everything, so we install dependencies. # This is an example; a custom Docker image would be more efficient. sudo apt-get update && sudo apt-get install -y python3-pip pip3 install -r requirements.txt cd dss-mvp1 && npm install && cd .. # Step 3: Configure Git - name: Configure Git run: | git config --global user.name "DSS Agent" git config --global user.email "dss-agent@overbits.luz.uy" # Step 4: Run the DSS Analysis - name: Run DSS Analysis run: | echo "Running DSS project analysis..." python3 dss-mvp1/dss-cli.py analyze --project-path . # Step 5: Commit and Push Changes if any - name: Commit and Push Context Changes run: | # Check if the analysis graph file has been changed if ! git diff --quiet .dss/analysis_graph.json; then echo "Change detected in analysis_graph.json. Committing and pushing..." # Add the file, commit, and push back to the same branch. # The GITEA_TOKEN is a secret you must configure in your project settings. git add .dss/analysis_graph.json git commit -m "chore(dss): Update project analysis context [skip ci]" # Use the GITEA_TOKEN for authentication # GITEA_SERVER_URL and GITEA_REPOSITORY are default environment variables in Gitea Actions. git push https://dss-agent:${{ secrets.GITEA_TOKEN }}@${GITEA_SERVER_URL}/${GITEA_REPOSITORY}.git HEAD:${GITEA_REF_NAME} else echo "No changes detected in project context. Nothing to commit." fi