diff --git a/.github/actions/add_job_link/action.yml b/.github/actions/add_job_link/action.yml new file mode 100644 index 00000000000..900fedd8f1b --- /dev/null +++ b/.github/actions/add_job_link/action.yml @@ -0,0 +1,40 @@ +name: 'Add job link to PR description' +inputs: + pull_request_number: + description: 'Pull Request number' + required: true + link_name: + description: 'Name of link, should contain only alphanumeric characters, dashes, and underscores' + required: true +runs: + using: "composite" + steps: + - name: Update PR description with preview link + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const prNumber = parseInt(${{ inputs.pull_request_number }}); + const newLink = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`; + const newLine = `[${{ inputs.link_name }}](${newLink})`; + + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber + }); + + let body = pr.body || ''; + const regex = /\[${{ inputs.link_name }}\]\([^)]+\)/; + + if (regex.test(body)) { + body = body.replace(regex, newLine); + } else { + body = body.trim() + `\n\n${newLine}`; + } + + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + body + }); diff --git a/.github/workflows/conformance_weight_compression.yml b/.github/workflows/conformance_weight_compression.yml index 9de6ac03807..bc8a7facacf 100644 --- a/.github/workflows/conformance_weight_compression.yml +++ b/.github/workflows/conformance_weight_compression.yml @@ -71,3 +71,23 @@ jobs: run: | pip install defusedxml==0.7.1 python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY + + update-pr-description: + name: Update PR description + runs-on: ubuntu-22.04 + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + permissions: + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + sparse-checkout: .github/actions/add_job_link + - name: Update PR preview link + uses: ./.github/actions/add_job_link + with: + pull_request_number: ${{ inputs.pull_request_number }} + link_name: "Test_Weight_Compression" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index fe34511cde6..8cd62230dc0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -203,3 +203,23 @@ jobs: run: | pip install defusedxml==0.7.1 python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY + + update-pr-description: + name: Update PR description + runs-on: ubuntu-22.04 + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + permissions: + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + sparse-checkout: .github/actions/add_job_link + - name: Update PR preview link + uses: ./.github/actions/add_job_link + with: + pull_request_number: ${{ inputs.pull_request_number }} + link_name: "Test_Examples" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 93f46a70d79..88ceb5b1a3c 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -90,3 +90,23 @@ jobs: export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} pytest tests/cross_fw/install -rA -s --host-configuration gpu --backend torch + + update-pr-description: + name: Update PR description + runs-on: ubuntu-22.04 + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + permissions: + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + sparse-checkout: .github/actions/add_job_link + - name: Update PR preview link + uses: ./.github/actions/add_job_link + with: + pull_request_number: ${{ inputs.pull_request_number }} + link_name: "Test_Install" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 311fda1171c..a1760ceb215 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -59,3 +59,23 @@ jobs: run: pytest -ra tests/openvino env: ONEDNN_MAX_CPU_ISA: AVX2 + + update-pr-description: + name: Update PR description + runs-on: ubuntu-22.04 + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }} + permissions: + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + with: + sparse-checkout: .github/actions/add_job_link + - name: Update PR preview link + uses: ./.github/actions/add_job_link + with: + pull_request_number: ${{ inputs.pull_request_number }} + link_name: "Test_MacOS" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}