From 385c21468a337ab8513a3b4662cbb103d43f3b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Mu=C3=B1oz?= Date: Mon, 2 Dec 2024 02:28:15 +0100 Subject: [PATCH] Update events-that-trigger-workflows.md (#53230) Co-authored-by: Sunbrye Ly <56200261+sunbrye@users.noreply.github.com> Co-authored-by: mc <42146119+mchammer01@users.noreply.github.com> Co-authored-by: Vanessa --- .../events-that-trigger-workflows.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/content/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows.md b/content/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows.md index 6edee3bb183d..d0217a2a17d7 100644 --- a/content/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows.md +++ b/content/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows.md @@ -1353,19 +1353,26 @@ jobs: artifact_id: matchArtifact.id, archive_format: 'zip', }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data)); + const fs = require('fs'); + const path = require('path'); + const temp = '{% raw %}${{ runner.temp }}{% endraw %}/artifacts'; + if (!fs.existsSync(temp)){ + fs.mkdirSync(temp); + } + fs.writeFileSync(path.join(temp, 'pr_number.zip'), Buffer.from(download.data)); - name: 'Unzip artifact' - run: unzip pr_number.zip + run: unzip pr_number.zip -d "{% raw %}${{ runner.temp }}{% endraw %}/artifacts" - name: 'Comment on PR' uses: {% data reusables.actions.action-github-script %} with: github-token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); + const fs = require('fs'); + const path = require('path'); + const temp = '{% raw %}${{ runner.temp }}{% endraw %}/artifacts'; + const issue_number = Number(fs.readFileSync(path.join(temp, 'pr_number'))); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo,