Skip to content

feat: Improved version control #5

feat: Improved version control

feat: Improved version control #5

Workflow file for this run

name: Create PR for latest Activity List and Collections
on:
workflow_dispatch:
repository_dispatch:
types: [activity-list-update]
pull_request:
branches: [ master ]
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v2
with:
ref: feature/improved-version-control
path: activity-list
- name: Download Zip File of latest activity list and collections from activity-list-editor.
run: |
mkdir -p downloads
wget -O downloads/openactive_concepts.zip https://oa-activity-list-staging-87b008e57ad8.herokuapp.com/en/openactive_concepts.zip
- name: Extract Zip File
run: |
mkdir -p activity-list-editor
unzip downloads/openactive_concepts.zip -d activity-list-editor
- name: Install jq
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Compare current activity list with activity list from activity-list-editor
id: compare
uses: openactive/skos-compare-action@main
with:
new_json_file: './activity-list-editor/activity-list.jsonld'
old_json_file: './activity-list/data/activity-list.jsonld'
# For security reasons, we only copy valid JSON-LD files to the next step
- name: Validate and Copy JSON-LD files
run: |
FILES=$(find activity-list-editor -name '*.jsonld')
for file in $FILES; do
if jq empty "$file" 2>/dev/null; then
echo "Valid JSON-LD: $file"
cp "$file" activity-list/data/
else
echo "Invalid JSON-LD, skipping: $file"
fi
done
- name: Generate list of changed files in /data/collections/ directory
id: collections_changed
run: |
git diff --name-only origin/master...HEAD -- ./data/collections/ > ../changed_collections_files.txt
echo "::set-output name=changed_files::$(cat ../changed_collections_files.txt)"
working-directory: ./activity-list/
- name: Create Pull Request
if: ${{ steps.compare.outputs.hasChanges || steps.collections_changed.outputs.changed_files }}
id: cpr
uses: peter-evans/create-pull-request@v6
with:
path: ./activity-list/
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
commit-message: Update activity list and collections
committer: openactive-bot <[email protected]>
author: openactive-bot <[email protected]>
signoff: false
branch: ci/update-activity-list
delete-branch: true
title: 'Update activity list and collections'
body: |
${{ steps.compare.outputs.hasChanges && 'The following changes have been made to the OpenActive Activity List:\n' }}:${{ steps.compare.outputs.changeDescription }}
${{ steps.collections_changed.outputs.changed_files && '\nThe following changes have been made to the OpenActive Collections:\n' }}:${{ steps.collections_changed.outputs.changed_files }}
labels: |
automated pr
draft: false
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"