Skip to content

Commit

Permalink
Merge pull request #347 from una-auxme/346-bug-drive-action-not-working
Browse files Browse the repository at this point in the history
Fixing the drive action
  • Loading branch information
JulianTrommer authored Oct 24, 2024
2 parents 96451c4 + 5aa49df commit 0ba55a1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,16 @@ jobs:
USERNAME=paf
USER_UID=1000
USER_GID=1000
- name: Save PR ID
env:
PR_ID: ${{ github.event.number }}
run: |
mkdir -p ./pr
echo $PR_ID > ./pr/pr_id
- name: Upload PR ID
uses: actions/upload-artifact@v4
with:
name: pr_id
path: pr/
31 changes: 29 additions & 2 deletions .github/workflows/drive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,34 @@ jobs:
run: |
echo "AGENT_VERSION=${AGENT_VERSION}"
echo "COMPOSE_FILE=${COMPOSE_FILE}"
- name: 'Download artifact (PR ID)'
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_id"
})[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_id.zip`, Buffer.from(download.data));
- name: 'Unzip artifact (PR ID)'
run: unzip pr_id.zip

- name: Run docker-compose
run: docker compose up --quiet-pull --exit-code-from agent
run: |
xhost +local:
USERNAME=$(whoami) USER_UID=$(id -u) USER_GID=$(id -g) docker compose up --quiet-pull --exit-code-from agent
- name: Copy results
run: docker compose cp agent:/tmp/simulation_results.json .
- name: Stop docker-compose
Expand Down Expand Up @@ -50,8 +76,9 @@ jobs:
// add everything to the resultsTable
resultsTable = resultsTableHeader + '\n' + resultsTableDivider + '\n' + resultsTable.join('\n');
// add the results as a comment to the pull request
let issue_number = Number(fs.readFileSync('./pr_id'));
github.rest.issues.createComment({
issue_number: context.issue.number,
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "## Simulation results\n" + resultsTable
Expand Down

0 comments on commit 0ba55a1

Please sign in to comment.