Skip to content

Update Metadata Files #359

Update Metadata Files

Update Metadata Files #359

name: Update Metadata Files
# Update the metadata information
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch: {}
jobs:
fetch-metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: "Checkout repository"
- name: "Setup Node.js"
uses: actions/setup-node@v3
with:
node-version: 16
- name: "Prepare collection of data from metadata repository"
run: |
cd .github/scripts
npm ci
- name: "Execute collection of data from metadata repository"
run: |
cd .github/scripts
export GH_ENTERPRISE_TOKEN=${{ secrets.GH_ENTERPRISE_TOKEN }}
export GH_ENTERPRISE_API_URL=${{ secrets.GH_ENTERPRISE_API_URL }}
export METADATA_SOURCE_VERSION=${{ secrets.METADATA_SOURCE_VERSION }}
export METADATA_SOURCE_DIR=${{ secrets.METADATA_SOURCE_DIR }}
export METADATA_SOURCE_REPO=${{ secrets.METADATA_SOURCE_REPO }}
export METADATA_SOURCE_OWNER=${{ secrets.METADATA_SOURCE_OWNER }}
npm run fetch:metadata
- name: "Store changes in GH repository"
run: |
git add -A
git config user.email "[email protected]"
git config user.name "BTP Metadata Repo Bot"
git diff --quiet && git diff --staged --quiet || git commit -m "[btpmr-bot] $(date '+%Y-%m-%d %H:%M:%S'): fetched BTP metadata"
git push origin ${{ github.ref_name }}
- name: Send event to dependent repositories
uses: actions/github-script@v6
with:
result-encoding: string
retry-exempt-status-codes: 400,401
retries: 3
github-token: ${{ secrets.BTPSA_EVENT_TOKEN }}
script: |
github.rest.repos.createDispatchEvent({
owner: "SAP-samples",
repo: "btp-setup-automator",
event_type: "btp-metadata-update"
})