Skip to content

Merge pull request #230 from catenax-ng/main #13

Merge pull request #230 from catenax-ng/main

Merge pull request #230 from catenax-ng/main #13

name: Update About Info
on:
push:
branches:
- main
workflow_dispatch:
jobs:
update-legal-notice-json:
runs-on: ubuntu-latest
# should run only on tractus-x to prevent amount of generated PRs
if: ${{ github.event.repository.name == 'traceability-foss' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Update legal-notice-json
run: |
echo "${{ github.sha }}" > commit-id.txt
REPO_NAME="${{ github.event.repository.name }}"
REPO_URL="${{ github.event.repository.html_url }}"
SOURCE_PATH="${REPO_URL}/tree/main"
echo "${SOURCE_PATH}" > source-path.txt
echo "${REPO_URL}" > repository-path.txt
echo "${REPO_URL}/blob/main/LICENSE" > license-path.txt
echo "${REPO_URL}/blob/main/NOTICE.md" > notice-path.txt
jq --arg commitId "$(cat commit-id.txt)" \
--arg sourcePath "$(cat source-path.txt)" \
--arg repositoryPath "$(cat repository-path.txt)" \
--arg licensePath "$(cat license-path.txt)" \
--arg noticePath "$(cat notice-path.txt)" \
--arg name "${REPO_NAME}" \
'.commitId = $commitId | .sourcePath = $sourcePath | .repositoryPath = $repositoryPath | .licensePath = $licensePath | .noticePath = $noticePath | .name = $name' \
frontend/src/assets/notice/legal-notice.json > updated.json
mv updated.json frontend/src/assets/notice/legal-notice.json
rm commit-id.txt source-path.txt repository-path.txt license-path.txt notice-path.txt
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update legal-notice.json with commit ID, source path, repository path, license path, notice path, and repository name
title: Update legal-notice.json
branch: update-legal-notice
body: |
This pull request updates the legal-notice.json file with the following information:
- Commit ID: ${{ github.sha }}
- Source Path: ${{ github.event.repository.html_url }}/tree/main
- Repository Path: ${{ github.event.repository.html_url }}
- License Path: ${{ github.event.repository.html_url }}/blob/main/LICENSE
- Notice Path: ${{ github.event.repository.html_url }}/blob/main/NOTICE.md
- Repository Name: ${{ github.event.repository.name }}
The Information is used to update the about page with the latest info about the commit
labels: |
auto-generated