From 2694d2edfe4bc287e07d2a783cccbfaf091edb04 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 6 Jan 2020 20:17:28 +0000 Subject: [PATCH 01/11] Refreshed wiki - Removed old Command Line Tools and update-wiki.sh - Split cli._main.run into new setup_parser function - New update-wiki.py that deprecates wiki repo's utils/*, generates Command-Line-Tools automatically --- .github/workflows/wiki.yaml | 69 +++ src/rez/cli/_main.py | 13 +- wiki/pages/Command-Line-Tools.md | 43 -- wiki/pages/Home.md | 112 +++++ wiki/pages/_Footer.md | 4 + wiki/pages/_Sidebar.md | 43 ++ wiki/update-wiki.py | 695 +++++++++++++++++++++++++++++++ wiki/update-wiki.sh | 30 -- 8 files changed, 935 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/wiki.yaml delete mode 100644 wiki/pages/Command-Line-Tools.md create mode 100644 wiki/pages/Home.md create mode 100644 wiki/pages/_Footer.md create mode 100644 wiki/pages/_Sidebar.md create mode 100644 wiki/update-wiki.py delete mode 100644 wiki/update-wiki.sh diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml new file mode 100644 index 000000000..22bb8abf6 --- /dev/null +++ b/.github/workflows/wiki.yaml @@ -0,0 +1,69 @@ +name: Wiki +on: + push: + branches: + - master + paths: + - 'wiki/**' + pull_request: + paths: + - 'wiki/**' +env: + CLONE_URL: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" + TEMP_WIKI_DIR: "wiki/.rez-gen-wiki-tmp" + + +jobs: + build: + name: Build Wiki Artifact + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Set up Python 2.7 + uses: actions/setup-python@v1 + with: + python-version: 2.7 + + - name: Build Wiki + run: | + git config --global color.ui always + python wiki/update-wiki.py \ + --keep-temp \ + --no-push \ + --wiki-dir="$(pwd)/$TEMP_WIKI_DIR" + + - uses: actions/upload-artifact@v1.0.0 + with: + name: wiki-markdown + path: wiki/.rez-gen-wiki-tmp + + + publish: + name: Publish to GitHub Wiki + runs-on: ubuntu-latest + # if: github.ref == 'refs/heads/master' + needs: build + + steps: + - uses: actions/download-artifact@master + with: + name: wiki-markdown + path: . + + - name: Setup git config + run: | + git config --global color.ui always + git config --global user.name "github.com/${{ github.actor }}" + git config --global user.email "${{ github.actor }}@${{ github.sha }}" + + - name: Git commit and push + run: | + git commit \ + -m "Generated from GitHub "${{ github.workflow }}" Workflow" \ + -m "See https://github.com/${{ github.repository }}/runs/${GITHUB_ACTION}" \ + || exit 0 + git remote set-url origin "$CLONE_URL" + git push origin master diff --git a/src/rez/cli/_main.py b/src/rez/cli/_main.py index 53e307b24..f8213096e 100644 --- a/src/rez/cli/_main.py +++ b/src/rez/cli/_main.py @@ -70,7 +70,13 @@ def __call__(self, parser, args, values, option_string=None): sys.exit(0) -def run(command=None): +def setup_parser(): + """Create and setup parser for given rez (sub) command. + + + Returns: + LazyArgumentParser: Argument parser for rez command. + """ sys.dont_write_bytecode = True @@ -99,6 +105,10 @@ def run(command=None): help='', # required so that it can be setup later setup_subparser=SetupRezSubParser(module_name)) + return parser + + +def run(command=None): # construct args list. Note that commands like 'rez-env foo' and # 'rez env foo' are equivalent if command: @@ -115,6 +125,7 @@ def run(command=None): else: arg_mode = None + parser = setup_parser() if arg_mode == "grouped": # args split into groups by '--' arg_groups = [[]] diff --git a/wiki/pages/Command-Line-Tools.md b/wiki/pages/Command-Line-Tools.md deleted file mode 100644 index 5d0ba185f..000000000 --- a/wiki/pages/Command-Line-Tools.md +++ /dev/null @@ -1,43 +0,0 @@ -## rez - -## rez-bind - -## rez-build - -## rez-config - -## rez-context - -## rez-depends - -## rez-diff - -## rez-env - -## rez-gui - -## rez-help - -## rez-interpret - -## rez-memcache - -## rez-plugins - -## rez-python - -## rez-release - -## rez-search - -## rez-selftest - -## rez-status - -## rez-suite - -## rez-test - -## rez-view - -## rez-yaml2py diff --git a/wiki/pages/Home.md b/wiki/pages/Home.md new file mode 100644 index 000000000..f7407dc55 --- /dev/null +++ b/wiki/pages/Home.md @@ -0,0 +1,112 @@ +[[media/rez_banner_128.png]] + +- [What Is Rez?](#what-is-rez) +- [The Basics](#the-basics) +- [Examples](#examples) + + +## What Is Rez? + +Rez is a cross-platform package manager with a difference. Using Rez you can create +standalone environments configured for a given set of packages. However, unlike many +other package managers, packages are not installed into these standalone environments. +Instead, all package versions are installed into a central repository, and standalone +environments reference these existing packages. This means that configured environments +are lightweight, and very fast to create, often taking just a few seconds to configure +despite containing hundreds of packages. + +

+ + +
Typical package managers install packages into an environment +

+ +
+

+ + +
Rez installs packages once, and configures environments dynamically +

+ +
+Rez takes a list of package requests, and constructs the target environment, resolving +all the necessary package dependencies. Any type of software package is supported - +compiled, python, applications and libraries. + + +## The Basics + +Packages are stored in repositories on disk. Each package has a single concise +definition file (*package.py*) that defines its dependencies, its commands (how it +configures the environment containing it), and other metadata. For example, the +following is the package definition file for the popular *requests* python module: + + name = "requests" + + version = "2.8.1" + + authors = ["Kenneth Reitz"] + + requires = [ + "python-2.7+" + ] + + def commands(): + env.PYTHONPATH.append("{root}/python") + +This package requires python-2.7 or greater. When used, the 'python' subdirectory +within its install location is appended to the PYTHONPATH environment variable. + +When an environment is created with the rez API or *rez-env* tool, a dependency +resolution algorithm tracks package requirements and resolves to a list of needed +packages. The commands from these packages are concatenated and evaluated, resulting +in a configured environment. Rez is able to configure environments containing +hundreds of packages, often within a few seconds. Resolves can also be saved to file, +and when re-evaluated later will reconstruct the same environment once more. + + +## Examples + +This example places the user into a resolved shell containing the requested packages, +using the [rez-env](https://github.com/nerdvegas/rez/wiki/Command-Line-Tools#rez-env) tool: + + ]$ rez-env requests-2.2+ python-2.6 'pymongo-0+<2.7' + + You are now in a rez-configured environment. + + resolved by ajohns@nn188.somewhere.com, on Wed Feb 26 15:56:20 2014, using Rez v2.0.0 + + requested packages: + requests-2.2+ + python-2.6 + pymongo-0+<2.7 + + resolved packages: + python-2.6.8 /software/ext/python/2.6.8 + platform-linux /software/ext/platform/linux + requests-2.2.1 /software/ext/requests/2.2.1/python-2.6 + pymongo-2.6.3 /software/ext/pymongo/2.6.3 + arch-x86_64 /software/ext/arch/x86_64 + + > ]$ _ + +This example creates an environment containing the package 'houdini' version 12.5 +or greater, and runs the command 'hescape -h' inside that environment: + + ]$ rez-env houdini-12.5+ -- hescape -h + Usage: hescape [-foreground] [-s editor] [filename ...] + -h: output this usage message + -s: specify starting desktop by name + -foreground: starts process in foreground + +Resolved environments can also be created via the API: + + >>> import subprocess + >>> from rez.resolved_context import ResolvedContext + >>> + >>> r = ResolvedContext(["houdini-12.5+", "houdini-0+<13", "java", "!java-1.8+"]) + >>> p = r.execute_shell(command='which hescape', stdout=subprocess.PIPE) + >>> out, err = p.communicate() + >>> + >>> print out + '/software/ext/houdini/12.5.562/bin/hescape' diff --git a/wiki/pages/_Footer.md b/wiki/pages/_Footer.md new file mode 100644 index 000000000..75a1e1c3e --- /dev/null +++ b/wiki/pages/_Footer.md @@ -0,0 +1,4 @@ +[![Google Group](https://img.shields.io/badge/rez--config-Google%20Group-blue?style=flat-square&logo=google)](https://groups.google.com/forum/#!forum/rez-config) +[![Contributing Guidelines](https://img.shields.io/badge/rez-Contributing%20Guidelines-0b610e?style=flat-square&logo=github)](https://github.com/nerdvegas/rez/blob/master/CONTRIBUTING.md) +[![Report A Bug](https://img.shields.io/badge/rez-Report%20A%20Bug-critical?style=flat-square&logo=github)](https://github.com/nerdvegas/rez/issues/new) +[![Slack](https://img.shields.io/badge/slack-rez--talk-7a6800?style=flat-square&logo=slack)](https://rez-talk.slack.com/) diff --git a/wiki/pages/_Sidebar.md b/wiki/pages/_Sidebar.md new file mode 100644 index 000000000..7eb3ac901 --- /dev/null +++ b/wiki/pages/_Sidebar.md @@ -0,0 +1,43 @@ +- [[Home]] + +:beginner: Introduction: + +- [[Installation]] and [[Pip]] +- [[Getting Started]] +- [[Basic Concepts]] +- [[Configuring Rez]] + +:memo: `package.py`: + +- [[Package Commands]] +- [[Package Definition Guide]] +- [[Variants]] + +:rocket: rez: + +- [[Contexts]] +- [[Suites]] +- [[Building Packages]] +- [[Environment Variables]] +- [[Command Line Tools]] +- [Python API](https://wwfxuk.github.io/rez/) :link: + +:information_source: Others: + +- [[Glossary]] +- [[FAQ]] +- [[Credits]] + +
:construction: Unwritten pages: + +- [[Advanced Topics]] +- [[Caching]] +- [[Releasing Packages]] +- [[Package Filters]] +- [[Testing Packages]] +- [[Rez GUI]] +- [[The Resolve Graph]] +- [[Timestamping]] +- [[Troubleshooting]] + +
\ No newline at end of file diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py new file mode 100644 index 000000000..e24444665 --- /dev/null +++ b/wiki/update-wiki.py @@ -0,0 +1,695 @@ +# -*- coding: utf-8 -*- +"""Python implementation of the ``update-wiki.sh``. + +This script: +1. Takes the content from this repo; +2. Then writes it into a local clone of https://github.com/nerdvegas/rez.wiki.git; +3. Then follows the procedure outlined in README from 2. + +This process exists because GitHub does not support contributions to wiki +repositories - this is a workaround. +""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +from collections import defaultdict +from io import open +import os +import re +import subprocess +import shutil +import sys + + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) +REZ_SOURCE_DIR = os.getenv("REZ_SOURCE_DIR", os.path.dirname(THIS_DIR)) + +TMP_NAME = ".rez-gen-wiki-tmp" # See also: .gitignore +TEMP_WIKI_DIR = os.getenv("TEMP_WIKI_DIR", os.path.join(THIS_DIR, TMP_NAME)) +CLONE_URL = os.getenv("CLONE_URL", "git@github.com:nerdvegas/rez.wiki.git") + + +################################################################################ +# https://github.com/rasbt/markdown-toclify +################################################################################ + +VALIDS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-&' + + +def read_lines(in_file): + """Returns a list of lines from a input markdown file.""" + + with open(in_file, 'r') as inf: + in_contents = inf.read().split('\n') + return in_contents + + +def remove_lines(lines, remove=('[[back to top]', ' tags.""" + + if not remove: + return lines[:] + + out = [] + for l in lines: + if l.startswith(remove): + continue + out.append(l) + return out + + +def dashify_headline(line): + """ + Takes a header line from a Markdown document and + returns a tuple of the + '#'-stripped version of the head line, + a string version for anchor tags, + and the level of the headline as integer. + E.g., + >>> dashify_headline('### some header lvl3') + ('Some header lvl3', 'some-header-lvl3', 3) + """ + stripped_right = line.rstrip('#') + stripped_both = stripped_right.lstrip('#') + level = len(stripped_right) - len(stripped_both) + stripped_wspace = stripped_both.strip() + + # character replacements + replaced_colon = stripped_wspace.replace('.', '') + replaced_slash = replaced_colon.replace('/', '') + rem_nonvalids = ''.join([c if c in VALIDS + else '-' for c in replaced_slash]) + + lowered = rem_nonvalids.lower() + dashified = re.sub(r'(-)\1+', r'\1', lowered) # remove duplicate dashes + dashified = dashified.strip('-') # strip dashes from start and end + + # exception '&' (double-dash in github) + dashified = dashified.replace('-&-', '--') + + return [stripped_wspace, dashified, level] + + +def tag_and_collect(file_lines, id_tag=True, back_links=False, exclude_h=None): + """ + Gets headlines from the markdown document and creates anchor tags. + Keyword arguments: + lines: a list of sublists where every sublist + represents a line from a Markdown document. + id_tag: if true, creates inserts a the tags (not req. by GitHub) + back_links: if true, adds "back to top" links below each headline + exclude_h: header levels to exclude. E.g., [2, 3] + excludes level 2 and 3 headings. + Returns a tuple of 2 lists: + 1st list: + A modified version of the input list where + anchor tags where inserted + above the header lines (if github is False). + 2nd list: + A list of 3-value sublists, where the first value + represents the heading, the second value the string + that was inserted assigned to the IDs in the anchor tags, + and the third value is an integer that reprents the headline level. + E.g., + [['some header lvl3', 'some-header-lvl3', 3], ...] + """ + out_contents = [] + headlines = [] + + for line in file_lines: + saw_headline = False + orig_len = len(line) + + if re.match(r'^\#{1,6} ', line): + line = line.lstrip() + + # comply with new markdown standards + + # not a headline if '#' not followed by whitespace '##no-header': + if not line.lstrip('#').startswith(' '): + continue + # not a headline if more than 6 '#': + if len(line) - len(line.lstrip('#')) > 6: + continue + # headers can be indented by at most 3 spaces: + if orig_len - len(line) > 3: + continue + + # ignore empty headers + if not set(line) - {'#', ' '}: + continue + + saw_headline = True + dashified = dashify_headline(line) + + if not exclude_h or not dashified[-1] in exclude_h: + if id_tag: + id_tag = '' + out_contents.append(id_tag.format(dashified=dashified)) + headlines.append(dashified) + + out_contents.append(line) + if back_links and saw_headline: + out_contents.append('[[back to top](#table-of-contents)]') + return out_contents, headlines + + +def positioning_headlines(headlines): + """ + Strips unnecessary whitespaces/tabs if first header is not left-aligned + """ + left_just = False + for row in headlines: + if row[-1] == 1: + left_just = True + break + if not left_just: + for row in headlines: + row[-1] -= 1 + return headlines + + +def create_toc(headlines, hyperlink=True, top_link=False, no_toc_header=False): + """ + Creates the table of contents from the headline list + that was returned by the tag_and_collect function. + Keyword Arguments: + headlines: list of lists + e.g., ['Some header lvl3', 'some-header-lvl3', 3] + hyperlink: Creates hyperlinks in Markdown format if True, + e.g., '- [Some header lvl1](#some-header-lvl1)' + top_link: if True, add a id tag for linking the table + of contents itself (for the back-to-top-links) + no_toc_header: suppresses TOC header if True. + Returns a list of headlines for a table of contents + in Markdown format, + e.g., [' - [Some header lvl3](#some-header-lvl3)', ...] + """ + processed = [] + if not no_toc_header: + if top_link: + processed.append('\n') + processed.append('# Table of Contents') + + for line in headlines: + indent = (line[2] - 1) * ' ' + if hyperlink: + item = '%s- [%s](#%s)' % (indent, line[0], line[1]) + else: + item = '%s- %s' % (indent, line[0]) + processed.append(item) + processed.append('\n') + return processed + + +def build_markdown(toc_headlines, body, spacer=0, placeholder=None): + """ + Returns a string with the Markdown output contents incl. + the table of contents. + Keyword arguments: + toc_headlines: lines for the table of contents + as created by the create_toc function. + body: contents of the Markdown file including + ID-anchor tags as returned by the + tag_and_collect function. + spacer: Adds vertical space after the table + of contents. Height in pixels. + placeholder: If a placeholder string is provided, the placeholder + will be replaced by the TOC instead of inserting the TOC at + the top of the document + """ + if spacer: + spacer_line = ['\n
\n' % (spacer)] + toc_markdown = "\n".join(toc_headlines + spacer_line) + else: + toc_markdown = "\n".join(toc_headlines) + + body_markdown = "\n".join(body).strip() + + if placeholder: + markdown = body_markdown.replace(placeholder, toc_markdown) + else: + markdown = toc_markdown + body_markdown + + return markdown + + +def output_markdown(markdown_cont, output_file): + """ + Writes to an output file if `outfile` is a valid path. + """ + if output_file: + with open(output_file, 'w') as out: + out.write(markdown_cont) + + +def markdown_toclify(input_file, output_file=None, github=False, + back_to_top=False, no_link=False, + no_toc_header=False, spacer=0, placeholder=None, + exclude_h=None): + """ Function to add table of contents to markdown files. + Parameters + ----------- + input_file: str + Path to the markdown input file. + output_file: str (defaul: None) + Path to the markdown output file. + github: bool (default: False) + Uses GitHub TOC syntax if True. + back_to_top: bool (default: False) + Inserts back-to-top links below headings if True. + no_link: bool (default: False) + Creates the table of contents without internal links if True. + no_toc_header: bool (default: False) + Suppresses the Table of Contents header if True + spacer: int (default: 0) + Inserts horizontal space (in pixels) after the table of contents. + placeholder: str (default: None) + Inserts the TOC at the placeholder string instead + of inserting the TOC at the top of the document. + exclude_h: list (default None) + Excludes header levels, e.g., if [2, 3], ignores header + levels 2 and 3 in the TOC. + Returns + ----------- + cont: str + Markdown contents including the TOC. + """ + raw_contents = read_lines(input_file) + cleaned_contents = remove_lines(raw_contents, remove=('[[back to top]', '\d+)\s+(?P.+)\s*$', + flags=re.MULTILINE | re.UNICODE + ) + + for match in regex.finditer(out): + author = match.group('author') + author_html = "%s
" % aliases.get(author.lower(), author) + contributors[author_html] += int(match.group('commits')) + + return '\n'.join( + author_html for author_html, commit_count in + sorted(contributors.items(), key=lambda x: x[1], reverse=True) + ) + + +def process_markdown_files(): + no_toc = [ + "Credits.md", + "Command-Line-Tools.md", + "Home.md", + "_Footer.md", + "_Sidebar.md", + ] + + pagespath = os.path.join(THIS_DIR, "pages") + + src_path = os.getenv("REZ_SOURCE_DIR") + if src_path is None: + print( + "Must provide REZ_SOURCE_DIR which points at root of " + "rez source clone", file=sys.stderr, + ) + sys.exit(1) + + def do_replace(filename, token, md): + srcfile = os.path.join(pagespath, "_%s.md" % filename) + destfile = os.path.join(TEMP_WIKI_DIR, "%s.md" % filename) + + # with open(srcfile) as f: + with open(srcfile, encoding='utf-8') as f: + txt = f.read() + + txt = txt.replace(token, md) + + print("Writing ", destfile, "...", sep="") + with open(destfile, 'w', encoding='utf-8') as f: + f.write(txt) + + # generate markdown from rezconfig.py, add to _Configuring-Rez.md and write + # out to Configuring-Rez.md + filepath = os.path.join(src_path, "src", "rez", "rezconfig.py") + with open(filepath) as f: + txt = f.read() + + md = convert_rezconfig_src_to_md(txt) + do_replace("Configuring-Rez", "__REZCONFIG_MD__", md) + + # generate markdown contributors list, add to _Credits.md and write out to + # Credits.md + md = create_contributors_md(src_path) + do_replace("Credits", "__CONTRIBUTORS_MD__", md) + + setup_cli_markdown(src_path) + + # process each md file: + # * adds TOC; + # * replaces short-form content links like '[[here:Blah.md#Header]]' with full form; + # * copies to the root dir. + # + skip_regex = r'^_(?!(Sidebar|Footer))|(? Date: Mon, 6 Jan 2020 20:23:03 +0000 Subject: [PATCH 02/11] Only publish on master branch --- .github/workflows/wiki.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 22bb8abf6..38bc733de 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -44,7 +44,7 @@ jobs: publish: name: Publish to GitHub Wiki runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' needs: build steps: From c055a86239496813b241bf03de899969de8e9f26 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 11:18:48 +0000 Subject: [PATCH 03/11] Updated from nerdvegas/rez.wiki.git d632328 --- .github/workflows/wiki.yaml | 2 +- wiki/pages/Notes.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 wiki/pages/Notes.md diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 38bc733de..22bb8abf6 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -44,7 +44,7 @@ jobs: publish: name: Publish to GitHub Wiki runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' needs: build steps: diff --git a/wiki/pages/Notes.md b/wiki/pages/Notes.md new file mode 100644 index 000000000..613fe1e41 --- /dev/null +++ b/wiki/pages/Notes.md @@ -0,0 +1,4 @@ + + +## Bez Deprecation + From 64e5e168f05eaa7d8ab279667d978498a8b9f349 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 11:48:01 +0000 Subject: [PATCH 04/11] Docs and explicit wiki url --- .github/workflows/wiki.yaml | 6 +++--- wiki/update-wiki.py | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 22bb8abf6..a4497361b 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -9,7 +9,6 @@ on: paths: - 'wiki/**' env: - CLONE_URL: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" TEMP_WIKI_DIR: "wiki/.rez-gen-wiki-tmp" @@ -33,12 +32,13 @@ jobs: python wiki/update-wiki.py \ --keep-temp \ --no-push \ - --wiki-dir="$(pwd)/$TEMP_WIKI_DIR" + --wiki-dir="$TEMP_WIKI_DIR" \ + --wiki-url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" - uses: actions/upload-artifact@v1.0.0 with: name: wiki-markdown - path: wiki/.rez-gen-wiki-tmp + path: ${{ env.TEMP_WIKI_DIR }} publish: diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index e24444665..ef1b73024 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Python implementation of the ``update-wiki.sh``. +"""Python implementation of old ``update-wiki.sh`` merged with ``process.py``. This script: 1. Takes the content from this repo; @@ -625,8 +625,23 @@ def _format_action(self, action): class UpdateWikiParser(argparse.ArgumentParser): - def __init__(self): - super(UpdateWikiParser, self).__init__(prog="Update GitHub Wiki") + """Parser flags, using global variables as defaults.""" + + def __init__(self, **kwargs): + """Setup default arguments and parser description/program name. + + If no parser description/program name are given, default ones will + be assigned. + + Args: + kwargs (dict[str]): + Same key word arguments taken by + ``argparse.ArgumentParser.__init__()`` + """ + kwargs.setdefault("prog", "update-wiki") + kwargs.setdefault("description", "Update GitHub Wiki") + super(UpdateWikiParser, self).__init__(**kwargs) + self.add_argument( "--no-push", action="store_false", From 075b8a8711d4224b6441b5a8aad9c7b32f915043 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 15:33:06 +0000 Subject: [PATCH 05/11] New generation logic --- .github/workflows/wiki.yaml | 21 ++- src/rez/cli/_main.py | 5 +- wiki/pages/_Command-Line-Tools.md | 3 + wiki/pages/_Configuring-Rez.md | 4 +- wiki/pages/{_Footer.md => __Footer.md} | 4 +- wiki/pages/{_Sidebar.md => __Sidebar.md} | 7 +- wiki/update-wiki.py | 156 +++++++++++++++++++---- 7 files changed, 163 insertions(+), 37 deletions(-) create mode 100644 wiki/pages/_Command-Line-Tools.md rename wiki/pages/{_Footer.md => __Footer.md} (75%) rename wiki/pages/{_Sidebar.md => __Sidebar.md} (68%) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index a4497361b..fc5ff52cf 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -9,13 +9,14 @@ on: paths: - 'wiki/**' env: - TEMP_WIKI_DIR: "wiki/.rez-gen-wiki-tmp" - + CLONE_URL: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" jobs: build: name: Build Wiki Artifact runs-on: ubuntu-latest + env: + TEMP_WIKI_DIR: "wiki/.rez-gen-wiki-tmp" steps: - name: Checkout @@ -29,11 +30,19 @@ jobs: - name: Build Wiki run: | git config --global color.ui always - python wiki/update-wiki.py \ + if [ "${{ github.event_name == 'pull_request' }}" == "true" ] + then + BRANCH="${{ github.head_ref }}" + else + BRANCH="${{ github.ref }}" + fi + + python "$(readlink -f wiki/update-wiki.py)" \ --keep-temp \ --no-push \ - --wiki-dir="$TEMP_WIKI_DIR" \ - --wiki-url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" + --github-branch="$BRANCH" \ + --wiki-dir="${{ env.TEMP_WIKI_DIR }}" \ + --wiki-url="${{ env.CLONE_URL }}" - uses: actions/upload-artifact@v1.0.0 with: @@ -65,5 +74,5 @@ jobs: -m "Generated from GitHub "${{ github.workflow }}" Workflow" \ -m "See https://github.com/${{ github.repository }}/runs/${GITHUB_ACTION}" \ || exit 0 - git remote set-url origin "$CLONE_URL" + git remote set-url origin "${{ env.CLONE_URL }}" git push origin master diff --git a/src/rez/cli/_main.py b/src/rez/cli/_main.py index f8213096e..444bc7878 100644 --- a/src/rez/cli/_main.py +++ b/src/rez/cli/_main.py @@ -77,9 +77,6 @@ def setup_parser(): Returns: LazyArgumentParser: Argument parser for rez command. """ - - sys.dont_write_bytecode = True - parser = LazyArgumentParser("rez") parser.add_argument("-i", "--info", action=InfoAction, @@ -125,6 +122,8 @@ def run(command=None): else: arg_mode = None + sys.dont_write_bytecode = True + parser = setup_parser() if arg_mode == "grouped": # args split into groups by '--' diff --git a/wiki/pages/_Command-Line-Tools.md b/wiki/pages/_Command-Line-Tools.md new file mode 100644 index 000000000..e268e0a0b --- /dev/null +++ b/wiki/pages/_Command-Line-Tools.md @@ -0,0 +1,3 @@ +Auto-generated from __WIKI_PY_URL__ + +__GENERATED_MD__ \ No newline at end of file diff --git a/wiki/pages/_Configuring-Rez.md b/wiki/pages/_Configuring-Rez.md index 9368671f4..e45fae8d8 100644 --- a/wiki/pages/_Configuring-Rez.md +++ b/wiki/pages/_Configuring-Rez.md @@ -2,7 +2,7 @@ Rez has a good number of configurable settings. The default settings, and documentation for every setting, can be found -[here](https://github.com/nerdvegas/rez/blob/master/src/rez/rezconfig.py). +[here](https://github.com/__GITHUB_REPO__/blob/master/src/rez/rezconfig.py). Settings are determined in the following way: @@ -102,7 +102,7 @@ Here is an example showing how to override settings using your own configuration Following is an alphabetical list of rez settings. > [[media/icons/info.png]] Note that this list has been generated automatically -> from the [rez-config.py](https://github.com/nerdvegas/rez/blob/master/src/rez/rezconfig.py) +> from the [rez-config.py](https://github.com/__GITHUB_REPO__/blob/master/src/rez/rezconfig.py) > file in the rez source, so you can also refer to that file for the same information. __REZCONFIG_MD__ diff --git a/wiki/pages/_Footer.md b/wiki/pages/__Footer.md similarity index 75% rename from wiki/pages/_Footer.md rename to wiki/pages/__Footer.md index 75a1e1c3e..07d2dd923 100644 --- a/wiki/pages/_Footer.md +++ b/wiki/pages/__Footer.md @@ -1,4 +1,4 @@ [![Google Group](https://img.shields.io/badge/rez--config-Google%20Group-blue?style=flat-square&logo=google)](https://groups.google.com/forum/#!forum/rez-config) -[![Contributing Guidelines](https://img.shields.io/badge/rez-Contributing%20Guidelines-0b610e?style=flat-square&logo=github)](https://github.com/nerdvegas/rez/blob/master/CONTRIBUTING.md) -[![Report A Bug](https://img.shields.io/badge/rez-Report%20A%20Bug-critical?style=flat-square&logo=github)](https://github.com/nerdvegas/rez/issues/new) +[![Contributing Guidelines](https://img.shields.io/badge/rez-Contributing%20Guidelines-0b610e?style=flat-square&logo=github)](https://github.com/__GITHUB_REPO__/blob/master/CONTRIBUTING.md) +[![Report A Bug](https://img.shields.io/badge/rez-Report%20A%20Bug-critical?style=flat-square&logo=github)](https://github.com/__GITHUB_REPO__/issues/new) [![Slack](https://img.shields.io/badge/slack-rez--talk-7a6800?style=flat-square&logo=slack)](https://rez-talk.slack.com/) diff --git a/wiki/pages/_Sidebar.md b/wiki/pages/__Sidebar.md similarity index 68% rename from wiki/pages/_Sidebar.md rename to wiki/pages/__Sidebar.md index 7eb3ac901..00045f4bc 100644 --- a/wiki/pages/_Sidebar.md +++ b/wiki/pages/__Sidebar.md @@ -1,3 +1,8 @@ +[![][wiki-badge]][wiki-actions] + +[wiki-badge]: https://github.com/__GITHUB_REPO__/workflows/__WORKFLOW__/badge.svg?branch=__BRANCH__ +[wiki-actions]: https://github.com/__GITHUB_REPO__/actions?query=workflow%3A__WORKFLOW__+branch%3A__BRANCH__ + - [[Home]] :beginner: Introduction: @@ -20,7 +25,7 @@ - [[Building Packages]] - [[Environment Variables]] - [[Command Line Tools]] -- [Python API](https://wwfxuk.github.io/rez/) :link: +- [Python API](https://___GITHUB_USER___.github.io/__REPO_NAME__/) :link: :information_source: Others: diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index ef1b73024..aebd4fbe3 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -1,13 +1,20 @@ # -*- coding: utf-8 -*- """Python implementation of old ``update-wiki.sh`` merged with ``process.py``. -This script: +This script calls git heavily to: 1. Takes the content from this repo; 2. Then writes it into a local clone of https://github.com/nerdvegas/rez.wiki.git; 3. Then follows the procedure outlined in README from 2. This process exists because GitHub does not support contributions to wiki repositories - this is a workaround. + +See Also: + Original wiki update script files: + + - ``wiki/update-wiki.sh`` at rez 2.50.0, which calls + - ``utils/process.py`` at rez.wiki d632328, and + - ``utils/update.sh`` at rez.wiki d632328 """ from __future__ import absolute_import from __future__ import division @@ -17,6 +24,7 @@ import argparse from collections import defaultdict from io import open +import inspect import os import re import subprocess @@ -24,12 +32,29 @@ import sys -THIS_DIR = os.path.dirname(os.path.abspath(__file__)) +ORIGINAL_getsourcefile = inspect.getsourcefile +THIS_FILE = os.path.abspath(__file__) +THIS_DIR = os.path.dirname(THIS_FILE) REZ_SOURCE_DIR = os.getenv("REZ_SOURCE_DIR", os.path.dirname(THIS_DIR)) TMP_NAME = ".rez-gen-wiki-tmp" # See also: .gitignore TEMP_WIKI_DIR = os.getenv("TEMP_WIKI_DIR", os.path.join(THIS_DIR, TMP_NAME)) -CLONE_URL = os.getenv("CLONE_URL", "git@github.com:nerdvegas/rez.wiki.git") +GITHUB_REPO = os.getenv("GITHUB_REPOSITORY", "nerdvegas/rez") +GITHUB_BRANCH = os.getenv("GITHUB_BRANCH", "master") +GITHUB_WORKFLOW = os.getenv("GITHUB_WORKFLOW", "Wiki") +CLONE_URL = os.getenv( + "CLONE_URL", + "git@github.com:{0}.wiki.git".format(GITHUB_REPO) +) + + +def PATCHED_getsourcefile(obj): + """Patch to not return None if path from inspect.getfile is not absolute. + + Returns: + str: Full path to source code file for an object, else this file path. + """ + return ORIGINAL_getsourcefile(obj) or THIS_FILE ################################################################################ @@ -429,7 +454,7 @@ def process_markdown_files(): ) sys.exit(1) - def do_replace(filename, token, md): + def do_replace(filename, token_md): srcfile = os.path.join(pagespath, "_%s.md" % filename) destfile = os.path.join(TEMP_WIKI_DIR, "%s.md" % filename) @@ -437,7 +462,8 @@ def do_replace(filename, token, md): with open(srcfile, encoding='utf-8') as f: txt = f.read() - txt = txt.replace(token, md) + for token, md in token_md.items(): + txt = txt.replace(token, md) print("Writing ", destfile, "...", sep="") with open(destfile, 'w', encoding='utf-8') as f: @@ -449,15 +475,44 @@ def do_replace(filename, token, md): with open(filepath) as f: txt = f.read() - md = convert_rezconfig_src_to_md(txt) - do_replace("Configuring-Rez", "__REZCONFIG_MD__", md) + do_replace( + "Configuring-Rez", + { + "__REZCONFIG_MD__": convert_rezconfig_src_to_md(txt), + "__GITHUB_REPO__": GITHUB_REPO, + } + ) # generate markdown contributors list, add to _Credits.md and write out to # Credits.md md = create_contributors_md(src_path) - do_replace("Credits", "__CONTRIBUTORS_MD__", md) + do_replace("Credits", {"__CONTRIBUTORS_MD__": md}) + + do_replace( + "Command-Line-Tools", + { + "__GENERATED_MD__": make_cli_markdown(src_path), + "__WIKI_PY_URL__": make_cli_source_link(), + } + ) + + do_replace("_Footer", {"__GITHUB_REPO__": GITHUB_REPO}) - setup_cli_markdown(src_path) + try: + from urllib import quote + except ImportError: + from urllib.parse import quote + user, repo_name = GITHUB_REPO.split('/') + do_replace( + "_Sidebar", + { + "__GITHUB_REPO__": GITHUB_REPO, + "___GITHUB_USER___": user, + "__REPO_NAME__": repo_name, + "__WORKFLOW__": quote(GITHUB_WORKFLOW, safe=""), + "__BRANCH__": quote(GITHUB_BRANCH, safe=""), + } + ) # process each md file: # * adds TOC; @@ -489,39 +544,59 @@ def do_replace(filename, token, md): # Command-Line-Tools.md functions and formatter classes ################################################################################ -def setup_cli_markdown(src_path): - """Generate the ``Command-Line-Tools.md`` directly to destination. +def make_cli_source_link(): + link = ( + "[{path}:{func.__name__}]" + "(https://github.com/{repo}/blob/{branch}/{path}#L{start}-L{end})" + ) + + try: + # Patch inspect.getsourcefile which is called by inspect.getsourcelines + inspect.getsourcefile = PATCHED_getsourcefile + lines, start = inspect.getsourcelines(make_cli_markdown) + finally: + inspect.getsourcefile = ORIGINAL_getsourcefile + + return link.format( + func=make_cli_markdown, + path=os.path.relpath(THIS_FILE, REZ_SOURCE_DIR), + repo=GITHUB_REPO, + branch=GITHUB_BRANCH, + start=start, + end=start + len(lines), + ) + - Hot-import rez cli library to get parsers +def make_cli_markdown(src_path): + """Generate the formatted markdown for each rez cli tool. + + Hot-import rez cli library to get parsers. Args: src_path (str): Full path to the rez source code repository. Returns: - str: Full path to the generated, destination markdown file. + str: Generated markdown text. """ sys.path.insert(0, os.path.join(src_path, "src")) try: from rez.cli._main import setup_parser from rez.cli._util import LazySubParsersAction - md_path = os.path.join(TEMP_WIKI_DIR, "Command-Line-Tools.md") main_parser = setup_parser() + command_help = [] parsers = [main_parser] for action in main_parser._actions: if isinstance(action, LazySubParsersAction): parsers += action.choices.values() - print("Writing ", md_path, "...", sep="") - with open(md_path, 'w', encoding='utf-8') as md_file: - for arg_parser in parsers: - arg_parser.formatter_class = MarkdownHelpFormatter - help_text = arg_parser.format_help() - md_file.write("{0}\n\n\n".format(help_text)) + for arg_parser in parsers: + arg_parser.formatter_class = MarkdownHelpFormatter + command_help.append(arg_parser.format_help()) finally: sys.path.pop(0) - return md_path + return "\n\n\n".join(command_help) class MarkdownHelpFormatter(argparse.ArgumentDefaultsHelpFormatter): @@ -626,6 +701,11 @@ def _format_action(self, action): class UpdateWikiParser(argparse.ArgumentParser): """Parser flags, using global variables as defaults.""" + INIT_DEFAULTS = ( + ("prog", "update-wiki"), + ("description", "Update GitHub Wiki"), + ("formatter_class", argparse.ArgumentDefaultsHelpFormatter), + ) def __init__(self, **kwargs): """Setup default arguments and parser description/program name. @@ -638,8 +718,8 @@ def __init__(self, **kwargs): Same key word arguments taken by ``argparse.ArgumentParser.__init__()`` """ - kwargs.setdefault("prog", "update-wiki") - kwargs.setdefault("description", "Update GitHub Wiki") + for key, value in self.INIT_DEFAULTS: + kwargs.setdefault(key, value) super(UpdateWikiParser, self).__init__(**kwargs) self.add_argument( @@ -654,6 +734,33 @@ def __init__(self, **kwargs): dest="keep", help="Don't remove temporary wiki repository directory.", ) + self.add_argument( + "--github-repo", + default=GITHUB_REPO, + dest="repo", + help=( + "Url to GitHub repository without leading github.com/. " + "Overrides environment variable GITHUB_REPOSITORY." + ) + ) + self.add_argument( + "--github-branch", + default=GITHUB_BRANCH, + dest="branch", + help=( + "Name of git branch that is generating the Wiki. " + "Overrides environment variable GITHUB_BRANCH." + ) + ) + self.add_argument( + "--github-workflow", + default=GITHUB_WORKFLOW, + dest="workflow", + help=( + "Name of GitHub workflow that is generating the Wiki. " + "Overrides environment variable GITHUB_WORKFLOW." + ) + ) self.add_argument( "--wiki-url", default=CLONE_URL, @@ -677,6 +784,9 @@ def __init__(self, **kwargs): if __name__ == "__main__": args = UpdateWikiParser().parse_args() CLONE_URL = args.url + GITHUB_REPO = args.repo + GITHUB_BRANCH = args.branch + GITHUB_WORKFLOW = args.workflow TEMP_WIKI_DIR = os.path.abspath(args.dir) if not os.path.exists(TEMP_WIKI_DIR): os.makedirs(TEMP_WIKI_DIR) From c2f063aa414623a8b6e57e9ba95d073bc5229c5e Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 17:03:54 +0000 Subject: [PATCH 06/11] Some tidy up --- .github/workflows/wiki.yaml | 2 +- wiki/update-wiki.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index fc5ff52cf..417908b3a 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -37,7 +37,7 @@ jobs: BRANCH="${{ github.ref }}" fi - python "$(readlink -f wiki/update-wiki.py)" \ + python wiki/update-wiki.py \ --keep-temp \ --no-push \ --github-branch="$BRANCH" \ diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index aebd4fbe3..ce5682c5c 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -545,8 +545,13 @@ def do_replace(filename, token_md): ################################################################################ def make_cli_source_link(): + """Create a markdown link to ``make_cli_markdown`` function on GitHub. + + Returns: + str: Formatted link to ``make_cli_markdown`` function on GitHub. + """ link = ( - "[{path}:{func.__name__}]" + "[`{path}:{func.__name__}()`]" "(https://github.com/{repo}/blob/{branch}/{path}#L{start}-L{end})" ) From 21d715784889313378f1f119de312d38ed25e32b Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 17:07:53 +0000 Subject: [PATCH 07/11] Only publish on master --- .github/workflows/wiki.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 417908b3a..e0d0c2d6f 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -53,7 +53,7 @@ jobs: publish: name: Publish to GitHub Wiki runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' needs: build steps: From f5e60bcc6554f86291421e8c8ec65da3bfdf9747 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 7 Jan 2020 17:30:46 +0000 Subject: [PATCH 08/11] Added Notes to Sidebar, more tidy --- src/rez/cli/_main.py | 8 ++++---- wiki/pages/__Sidebar.md | 1 + wiki/update-wiki.py | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/rez/cli/_main.py b/src/rez/cli/_main.py index 444bc7878..ea1031cc7 100644 --- a/src/rez/cli/_main.py +++ b/src/rez/cli/_main.py @@ -71,8 +71,7 @@ def __call__(self, parser, args, values, option_string=None): def setup_parser(): - """Create and setup parser for given rez (sub) command. - + """Create and setup parser for given rez command line interface. Returns: LazyArgumentParser: Argument parser for rez command. @@ -106,6 +105,9 @@ def setup_parser(): def run(command=None): + + sys.dont_write_bytecode = True + # construct args list. Note that commands like 'rez-env foo' and # 'rez env foo' are equivalent if command: @@ -122,8 +124,6 @@ def run(command=None): else: arg_mode = None - sys.dont_write_bytecode = True - parser = setup_parser() if arg_mode == "grouped": # args split into groups by '--' diff --git a/wiki/pages/__Sidebar.md b/wiki/pages/__Sidebar.md index 00045f4bc..a02400609 100644 --- a/wiki/pages/__Sidebar.md +++ b/wiki/pages/__Sidebar.md @@ -31,6 +31,7 @@ - [[Glossary]] - [[FAQ]] +- [[Notes]] - [[Credits]]
:construction: Unwritten pages: diff --git a/wiki/update-wiki.py b/wiki/update-wiki.py index ce5682c5c..1ec6eae3c 100644 --- a/wiki/update-wiki.py +++ b/wiki/update-wiki.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- """Python implementation of old ``update-wiki.sh`` merged with ``process.py``. +*From ``update-wiki.sh``* + This script calls git heavily to: 1. Takes the content from this repo; 2. Then writes it into a local clone of https://github.com/nerdvegas/rez.wiki.git; @@ -13,8 +15,8 @@ Original wiki update script files: - ``wiki/update-wiki.sh`` at rez 2.50.0, which calls - - ``utils/process.py`` at rez.wiki d632328, and - - ``utils/update.sh`` at rez.wiki d632328 + - ``utils/process.py`` from nerdvegas/rez.wiki at d632328, and + - ``utils/update.sh`` from nerdvegas/rez.wiki at d632328 """ from __future__ import absolute_import from __future__ import division @@ -706,11 +708,11 @@ def _format_action(self, action): class UpdateWikiParser(argparse.ArgumentParser): """Parser flags, using global variables as defaults.""" - INIT_DEFAULTS = ( - ("prog", "update-wiki"), - ("description", "Update GitHub Wiki"), - ("formatter_class", argparse.ArgumentDefaultsHelpFormatter), - ) + INIT_DEFAULTS = { + "prog": "update-wiki", + "description": "Update GitHub Wiki", + "formatter_class": argparse.ArgumentDefaultsHelpFormatter, + } def __init__(self, **kwargs): """Setup default arguments and parser description/program name. @@ -723,7 +725,7 @@ def __init__(self, **kwargs): Same key word arguments taken by ``argparse.ArgumentParser.__init__()`` """ - for key, value in self.INIT_DEFAULTS: + for key, value in self.INIT_DEFAULTS.items(): kwargs.setdefault(key, value) super(UpdateWikiParser, self).__init__(**kwargs) From d004bd2ebc2d183958a48c830b71501ab56b4bb4 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Wed, 11 Mar 2020 16:00:41 +0000 Subject: [PATCH 09/11] Fixed refs/ branch name --- .github/workflows/wiki.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index e0d0c2d6f..4c6357a71 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -40,7 +40,7 @@ jobs: python wiki/update-wiki.py \ --keep-temp \ --no-push \ - --github-branch="$BRANCH" \ + --github-branch="${BRANCH##refs*/}" \ --wiki-dir="${{ env.TEMP_WIKI_DIR }}" \ --wiki-url="${{ env.CLONE_URL }}" From d45173dc3c3b92e5a28602a3e48a2a7df911cf27 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 20 Apr 2020 16:57:00 +0100 Subject: [PATCH 10/11] force CI test --- .github/workflows/wiki.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 4c6357a71..28502bb42 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -1,13 +1,13 @@ name: Wiki -on: - push: - branches: - - master - paths: - - 'wiki/**' - pull_request: - paths: - - 'wiki/**' +on: [push] + # push: + # branches: + # - master + # paths: + # - 'wiki/**' + # pull_request: + # paths: + # - 'wiki/**' env: CLONE_URL: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" @@ -53,7 +53,7 @@ jobs: publish: name: Publish to GitHub Wiki runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' needs: build steps: From 049ba9f2fdf8cd5353cab4ae51fb3450c9ce7394 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Mon, 20 Apr 2020 17:04:35 +0100 Subject: [PATCH 11/11] Reverted --- .github/workflows/wiki.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index 28502bb42..4c6357a71 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -1,13 +1,13 @@ name: Wiki -on: [push] - # push: - # branches: - # - master - # paths: - # - 'wiki/**' - # pull_request: - # paths: - # - 'wiki/**' +on: + push: + branches: + - master + paths: + - 'wiki/**' + pull_request: + paths: + - 'wiki/**' env: CLONE_URL: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git" @@ -53,7 +53,7 @@ jobs: publish: name: Publish to GitHub Wiki runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' needs: build steps: