From af0db9b0064b61ffdfcd0a2e7d2c91db898f2e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Rosi=C5=84ski?= Date: Mon, 5 Aug 2024 13:30:52 +0200 Subject: [PATCH] Export list of modified files as an output --- README.md | 1 + src/index.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index c4c7fe56..a2163971 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ Here are all the inputs [repo-file-sync-action](https://github.com/BetaHuhn/repo ### Outputs The action sets the `pull_request_urls` output to the URLs of any created Pull Requests. It will be an array of URLs to each PR, e.g. `'["https://github.com/username/repository/pull/number", "..."]'`. +A `modified_files` array consisting of absolute paths to all modified/rendered files is also exported, which could be used for further validation or post-processing. e.g. `["tmp/github.com/my-org/my-repo@default/.github/workflows/build.yaml"]` ## 🛠️ Sync Configuration diff --git a/src/index.js b/src/index.js index 858fdd0a..bef183a9 100644 --- a/src/index.js +++ b/src/index.js @@ -31,6 +31,7 @@ async function run() { const prUrls = [] + const modifiedFiles = [] await forEach(repos, async (item) => { core.info(`Repository Info`) core.info(`Slug : ${ item.repo.name }`) @@ -111,6 +112,8 @@ async function run() { useOriginalMessage: useOriginalCommitMessage, commitMessage: message[destExists].commit }) + + modifiedFiles.push(dest) } }) @@ -200,8 +203,12 @@ async function run() { core.setFailed(err.message) core.debug(err) } + }) + core.setOutput('modified_files', modifiedFiles) + core.debug('Modified files: ' + modifiedFiles) + // If we created any PRs, set their URLs as the output if (prUrls) { core.setOutput('pull_request_urls', prUrls)