[CI] Testing PR comment from another workflow (#2127)

This commit is contained in:
Zahi Moudallal
2023-08-17 17:34:59 -07:00
committed by GitHub
parent 871ec2ad37
commit 6f654cfbbf
2 changed files with 49 additions and 2 deletions

View File

@@ -9,7 +9,44 @@ on:
jobs:
Compare-artifacts:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Echo
run: echo "Testing new workflow"
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip pr_number.zip
- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync('./pr_number'));
echo $issue_number
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Ignore this message. This is to test another workflow posting comment on PR number ${issue_number}.'
});

View File

@@ -153,6 +153,16 @@ jobs:
sudo nvidia-smi -i 0 --lock-gpu-clocks=1280,1280
python3 -m pytest -vs . --reruns 10
sudo nvidia-smi -i 0 -rgc
- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: |
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
- uses: actions/upload-artifact@v3
with:
name: pr_number
path: pr/
Integration-Tests-Third-Party:
needs: Runner-Preparation