forked from finos/open-developer-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding GitHub action that enforces FINOS blueprint
This action runs on a cron and invokes a metadata-tool action. It generates a report of all missing configurations across all github.com/finos repos. Based on that, it will create issues for all repos, assuming there is no issue on that repo with the same title. See Issue finos#31
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:[email protected]/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# This script generates the repo issues | ||
|
||
generate_post_data() | ||
{ | ||
cat <<EOF | ||
{ | ||
"title": "$ISSUE_TITLE", | ||
"body": "$ISSUE_DESCRIPTION" | ||
} | ||
EOF | ||
} | ||
|
||
if [ -z $ISSUE_TITLE ]; then | ||
ISSUE_TITLE="[FINOS_PROJECT_BLUEPRINT] - Fixes to apply" | ||
fi | ||
|
||
rm -rf /tmp/existing-issues.txt | ||
|
||
# Generate list of repos that already have an issue created with $ISSUE_TITLE | ||
curl -s -G "https://api.github.com/search/issues" --data-urlencode "q='$ISSUE_TITLE' in:title org:finos" -H "Accept: application/vnd.github.preview" | jq '.items[] | (.repository_url/"/" | (.[-2] + "/" + .[-1]))' | tr -d '"' | sort | uniq > /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |