Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export list of modified files as an output #342

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }`)
Expand Down Expand Up @@ -111,6 +112,8 @@ async function run() {
useOriginalMessage: useOriginalCommitMessage,
commitMessage: message[destExists].commit
})

modifiedFiles.push(dest)
}
})

Expand Down Expand Up @@ -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)
Expand Down