From 32f594bd4399ecfedbf548e7268fe1e58199db18 Mon Sep 17 00:00:00 2001 From: hminaee-tc Date: Fri, 23 Aug 2024 23:03:00 -0300 Subject: [PATCH] fix/mirror: cleanup --- .github/workflows/call-github-set-topic.yml | 58 --------------------- .github/workflows/github-call-set-topic.yml | 41 +++++++++++++++ 2 files changed, 41 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/call-github-set-topic.yml create mode 100644 .github/workflows/github-call-set-topic.yml diff --git a/.github/workflows/call-github-set-topic.yml b/.github/workflows/call-github-set-topic.yml deleted file mode 100644 index e102917..0000000 --- a/.github/workflows/call-github-set-topic.yml +++ /dev/null @@ -1,58 +0,0 @@ ---- -name: call-set-topic -on: - push: - branches: - - main - -jobs: - call-set-topic: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Get Token - id: get_workflow_token - uses: peter-murray/workflow-application-token-action@v3 - with: - application_id: ${{ secrets.GH_APP_REPO_ACTION_RW_APPLICATION_ID }} - application_private_key: ${{ secrets.GH_APP_REPO_ACTION_RW_PRIVATE_KEY }} - revoke_token: true - - - name: Read .project-properties.json if it exists - id: read-properties - run: | - if [ -f ".project-properties.json" ]; then - properties=$(jq -c . ./.project-properties.json) - echo "PROPERTIES=$properties" >> $GITHUB_ENV - else - echo "PROPERTIES={}" >> $GITHUB_ENV - fi - - - name: Stringify JSON Data - run: | - properties_escaped=$(echo '${{ env.PROPERTIES }}' | sed 's/"/\\"/g') - echo "PROPERTIES_ESCAPED=$properties_escaped" >> $GITHUB_ENV - - - name: Debug Stringified JSON Data - run: | - echo "JSON Data which will be sent: ${{ env.PROPERTIES_ESCAPED }}" - - - name: Trigger reusable workflow via API - uses: opencepk/opencepk-module-ghactions-common/trigger-workflow-action@fix/update-gitmodules-action - with: - token: ${{ steps.get_workflow_token.outputs.token }} - repo: 'opencepk/opencepk-projects-hub' - workflow_id: 'github-set-topic-workflow.yml' - ref: 'main' - inputs: '{"repo":"${{ github.repository }}", "properties":"${{ env.PROPERTIES_ESCAPED }}"}' - - # - name: Trigger reusable workflow via API - # run: | - # curl -X POST \ - # -H "Accept: application/vnd.github.v3+json" \ - # -H "Authorization: token ${{ steps.get_workflow_token.outputs.token }}" \ - # -d '{"ref":"main", "inputs":{"repo":"${{ github.repository }}", \ - # "properties":"${{ env.PROPERTIES_ESCAPED }}"}}' \ - # https://api.github.com/repos/opencepk/opencepk-projects-hub/actions/workflows/github-set-topic-workflow.yml/dispatches diff --git a/.github/workflows/github-call-set-topic.yml b/.github/workflows/github-call-set-topic.yml new file mode 100644 index 0000000..4303921 --- /dev/null +++ b/.github/workflows/github-call-set-topic.yml @@ -0,0 +1,41 @@ +--- +name: github-call-set-topic +on: + push: + branches: + - main + +jobs: + call-set-topic: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get Token + id: get_workflow_token + uses: peter-murray/workflow-application-token-action@v3 + with: + application_id: ${{ secrets.GH_APP_REPO_ACTION_RW_APPLICATION_ID }} + application_private_key: ${{ secrets.GH_APP_REPO_ACTION_RW_PRIVATE_KEY }} + revoke_token: true + + - name: Read and Stringify JSON Data + id: read-and-stringify-json + uses: opencepk/opencepk-module-ghactions-common/read-and-stringify-json-action@fix/update-gitmodules-action + with: + file: '.project-properties.json' + file_type: 'json' + + - name: Debug Stringified JSON Data + run: | + echo "JSON Data which will be sent: ${{ steps.read-and-stringify-json.outputs.properties }}" + + - name: Trigger reusable workflow via API + uses: opencepk/opencepk-module-ghactions-common/trigger-workflow-action@fix/update-gitmodules-action + with: + token: ${{ steps.get_workflow_token.outputs.token }} + repo: 'opencepk/opencepk-projects-hub' + workflow_id: 'github-set-topic-workflow.yml' + ref: 'main' + inputs: '{"repo":"${{ github.repository }}", "properties":"${{ env.PROPERTIES_ESCAPED }}"}'