diff --git a/.gitea/workflows/create-weekly-analytics-stats.yaml b/.gitea/workflows/create-weekly-analytics-stats.yaml index c6f87bd..3558fff 100644 --- a/.gitea/workflows/create-weekly-analytics-stats.yaml +++ b/.gitea/workflows/create-weekly-analytics-stats.yaml @@ -49,14 +49,30 @@ jobs: --limit "10" - name: Commit and push results + id: commit_step run: | git config --global user.name "gitea-actions[bot]" git config --global user.email "actions@users.noreply.local" git checkout -B analytics-update git add analytics/ if git diff --cached --quiet; then - echo "No changes to commit" + echo "ANALYTICS_CHANGES=false" >> $GITEA_ENV else - git commit -m "chore: update analytics data [skip ci]" + git commit -m "chore: update analytics data" git push origin analytics-update --force + echo "ANALYTICS_CHANGES=true" >> $GITEA_ENV fi + + - name: Create Pull Request in Gitea + if: env.ANALYTICS_CHANGES == 'true' + run: | + curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + https://gitea.eco.tsi-dev.otc-service.com/api/v1/repos/infra/otc-metadata-rework/pulls \ + -d '{ + "title": "chore: weekly update analytics data", + "head": "analytics-update", + "base": "main", + "body": "Auto-Update of Analytics-data" + }'