Skip to content

Commit

Permalink
Fixing archive name and testing archive commenting.
Browse files Browse the repository at this point in the history
  • Loading branch information
JPGlaser committed Oct 16, 2024
1 parent 507419c commit 441af4d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/commenting_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Bind Reports to Pull-Request

# Triggered by the name of the previos
on:
workflow_run:
workflows: ["Notebook Pipeline (Ubuntu)"]
types: [completed]

# Enable the option to post a comment
permissions:
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
# Check that the previos workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Get Artifacts Link
env:
WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }}
GH_TOKEN: ${{ github.token }}
run: |
PREVIOUS_JOB_ID=$(jq -r '.id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
SUITE_ID=$(jq -r '.check_suite_id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
# Sample for a single artifact, can be improved for a multiple artifacts
ARTIFACT_ID=$(gh api "/repos/${{ github.repository }}/actions/artifacts" \
--jq ".artifacts.[] |
select(.workflow_run.id==${PREVIOUS_JOB_ID}) |
.id")
echo "ARTIFACT_URL=https://github.com/${{ github.repository }}/suites/${SUITE_ID}/artifacts/${ARTIFACT_ID}" >> $GITHUB_ENV
PR_NUMBER=$(jq -r '.pull_requests[0].number' <<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
- uses: actions/github-script@v6
env:
PR_NUMBER: ${{ env.PR_NUMBER }}
PR_NOTES: |
Build artifacts:
| Name | Link |
|------|------|
| NB/WB Pipeline | [Archived ZIP](${{ env.ARTIFACT_URL }}) |
with:
script: |
github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.PR_NOTES
})
7 changes: 5 additions & 2 deletions .github/workflows/test_notebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ jobs:
- name: Archive Notebook Output Files
uses: actions/upload-artifact@v4
with:
name: TestNB-OutputFiles
name: TestNB-OutputFiles_${{ matrix.python-version }}_${{ matrix.os }}_${{ steps.date.outputs.date }}
path: |
nb_outputs
nb_outputs/*/*.pdf
nb_outputs/*/*.tim
nb_outputs/*/*.par
compression-level: 6

0 comments on commit 441af4d

Please sign in to comment.