Skip to content

Commit

Permalink
Merge pull request #71 from cicirello/fix-deprecated
Browse files Browse the repository at this point in the history
Replaced usage of GitHub Action's deprecated set-output
  • Loading branch information
cicirello authored Oct 20, 2022
2 parents b2a3ffc + d591d2a commit b1e9fb4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - 2022-10-19
## [Unreleased] - 2022-10-20

### Added

Expand All @@ -15,8 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Fixed
* Now handles alternate casing of boolean inputs specified in GitHub workflow YAML files,
where it previously expected lowercase only.
* Replaced the usage of GitHub Action's deprecated `set-output` with the new `$GITHUB_OUTPUT` env file.
* Handle alternate casing of boolean inputs in GitHub workflow YAML files (previously expected lowercase).
* Refactored entrypoint for improved maintainability, and ease of planned new functionality.

### CI/CD
Expand Down
20 changes: 16 additions & 4 deletions generatesitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ def writeXmlSitemap(files, baseUrl, dropExtension=False) :
sitemap.write("\n")
sitemap.write('</urlset>\n')

def set_outputs(names_values) :
"""Sets the GitHub Action outputs.
Keyword arguments:
names_values - Dictionary of output names with values
"""
if "GITHUB_OUTPUT" in os.environ :
with open(os.environ["GITHUB_OUTPUT"], "a") as f :
for name, value in names_values.items() :
print("{0}={1}".format(name, value), file=f)

def main(
websiteRoot,
baseUrl,
Expand Down Expand Up @@ -332,10 +343,11 @@ def main(
writeTextSitemap(files, baseUrl, dropExtension)
pathToSitemap += "sitemap.txt"

print("::set-output name=sitemap-path::" + pathToSitemap)
print("::set-output name=url-count::" + str(len(files)))
print("::set-output name=excluded-count::" + str(len(allFiles)-len(files)))

set_outputs({
"sitemap-path" : pathToSitemap,
"url-count" : len(files),
"excluded-count" : len(allFiles)-len(files)
})

if __name__ == "__main__" :
main(
Expand Down

0 comments on commit b1e9fb4

Please sign in to comment.