diff --git a/.github/workflows/project-blueprint.yml b/.github/workflows/project-blueprint.yml new file mode 100644 index 00000000..5cedd785 --- /dev/null +++ b/.github/workflows/project-blueprint.yml @@ -0,0 +1,32 @@ +name: project-blueprint-action + +# This GitHub action checks all FINOS GitHub repositories against a list of validations, and opens an issue on the repository with the missing items. +# If the issue already exists, it skips the repository +on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 0 1 * *' + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FINOS_TOKEN: ${{ secrets.FINOS_TOKEN }} + ISSUE_TITLE: "[FINOS_PROJECT_BLUEPRINT] - Fixes to apply" + +jobs: + create-issues: + runs-on: ubuntu-latest + steps: + - name: Install jq + run: sudo apt-get install jq + - name: Checking out metadata-tool + uses: actions/checkout@v2 + with: + repository: 'finos/metadata-tool' + path: 'metadata-tool' + ref: blueprint-check + - name: Checking out FINOS metadata + run: git clone https://finos-admin:$FINOS_TOKEN@github.com/finos-admin/metadata.git >/dev/null + - name: Generating repository validation + run: curl -s https://raw.githubusercontent.com/finos/open-developer-platform/master/scripts/generate-repo-validation.sh | bash + - name: Checking existing issues + run: curl -s https://raw.githubusercontent.com/finos/open-developer-platform/master/scripts/check-existing-issues.sh | bash \ No newline at end of file diff --git a/scripts/generate-repo-issues.sh b/scripts/generate-repo-issues.sh new file mode 100755 index 00000000..e8a02240 --- /dev/null +++ b/scripts/generate-repo-issues.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# This script generates the repo issues + +generate_post_data() +{ + cat < /tmp/existing-issues.txt + +cat metadata-tool/finos-repo-validation.json | jq -r '.[]| [.org, .["repo-name"]] | @tsv' | + while IFS=$'\t' read -r ORG REPO; do + ISSUE_EXIST=`cat /tmp/existing-issues.txt | grep "$ORG/$REPO"` + if [ -z "$ISSUE_EXIST" ]; then + cat finos-repo-validation.json | jq -r '.[] | select(.org == env.ORG and .["repo-name"] == env.REPO) | .message' > /tmp/$ORG-$REPO-issue-description.txt + echo "Creating issue for repo $ORG/$REPO; text generated into /tmp/$ORG-$REPO-issue-description.txt" + echo "Still disabled! Waiting for community announcement" + # curl -d "$(generate_post_data)" https://api.github.com/repos/$ORG/$REPO/issues + # echo curl -d "$(generate_post_data)" https://api.github.com/repos/$ORG/$REPO/issues + echo -------- + fi + done \ No newline at end of file diff --git a/scripts/generate-repo-validation.sh b/scripts/generate-repo-validation.sh new file mode 100755 index 00000000..f812808d --- /dev/null +++ b/scripts/generate-repo-validation.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# This script generates the repo validation + +# Avoid metadata tool failure +export BITERGIA_USER="empty" +export BITERGIA_PASSWORD="empty" + +# Append Meeting addendance data +cd metadata-tool +lein run -- check-project-repos -m ../metadata