V1.43 #15
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
name: PR to DEV | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: | |
- '!main' | |
- '!v**' | |
- 'dev' | |
paths-ignore: | |
- '**/README.md' | |
- '.github/*' | |
env: | |
USER_INFO: ${{ github.event.pull_request.user.login }} | |
REPO_INFO: ${{ github.event.pull_request.base.repo.full_name }} | |
jobs: | |
check_permission: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Permission | |
uses: octokit/[email protected] | |
id: get_permission | |
with: | |
route: GET /repos/${{ env.REPO_INFO }}/collaborators/${{ env.USER_INFO }}/permission | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: output | |
run: | | |
export role_name=${{ fromJson(steps.get_permission.outputs.data).role_name }} | |
if [[ "$role_name" == "maintain" || "$role_name" == "admin" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
check_validation: | |
runs-on: ubuntu-latest | |
needs: check_permission | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Checkout validation suite | |
uses: actions/checkout@v2 | |
with: | |
repository: ror-community/validation-suite | |
path: validation-suite | |
- name: Validate files | |
id: validatefiles | |
run: | | |
mkdir files | |
cp ./${{github.event.pull_request.head.ref}}/*.json files/ | |
cd validation-suite | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
curl https://raw.githubusercontent.com/ror-community/ror-schema/schema-v2/ror_schema_v2_0.json -o ror_schema_v2_0.json | |
if [[ -f "../${{github.event.pull_request.head.ref}}/relationships.csv" ]]; then | |
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json -f ../${{github.event.pull_request.head.ref}}/relationships.csv -p ../files/ --no-geonames | |
else | |
python run_validations.py -i ../files -v 2 -s ror_schema_v2_0.json --no-geonames | |
fi | |
- name: Notify Slack | |
if: always() | |
uses: edge/simple-slack-notify@master | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }} | |
with: | |
channel: '#ror-curation-releases' | |
color: 'good' | |
text: 'Validation status during PR to DEV: ${{ steps.validatefiles.outcome }}. Using v2. On branch: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/tree/${env.GITHUB_HEAD_REF}. In directory: ${env.GITHUB_HEAD_REF}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}' | |