diff --git a/.github/workflows/recompile-requirements.yml b/.github/workflows/recompile-requirements.yml index a9bd1a8eb..770a5163b 100644 --- a/.github/workflows/recompile-requirements.yml +++ b/.github/workflows/recompile-requirements.yml @@ -16,6 +16,7 @@ jobs: python-version: '3.x' - name: Recompile requirements run: python3 scripts/dev/recompile_requirements.py + id: requirements - name: Create pull request uses: peter-evans/create-pull-request@v2 with: @@ -24,5 +25,10 @@ jobs: token: ${{ secrets.QUTEBROWSER_BOT_TOKEN }} commit-message: Update dependencies title: Update dependencies - body: "I'm a bot, bleep, bloop. :robot:" + body: | + I'm a bot, bleep, bloop. :robot: + + --- + + ${{ steps.requirements.outputs.changed }} branch: update-dependencies diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py index 7574fdb4b..89e41cd4d 100644 --- a/scripts/dev/recompile_requirements.py +++ b/scripts/dev/recompile_requirements.py @@ -163,6 +163,30 @@ def parse_args(): return parser.parse_args() +def print_changed_files(): + changed = set() + proc = subprocess.run(['git', '--no-pager', 'diff', '--name-only'], + stdout=subprocess.PIPE, encoding='utf-8', check=True) + lines = proc.stdout.splitlines() + for line in lines: + line = line.strip() + if not (line.startswith('misc/requirements/') or + line == 'requirements.txt'): + continue + line = line.replace('misc/requirements/requirements-', '') + line = line.replace('.txt', '') + changed.add(line) + + utils.print_title('Changed files') + text = '\n'.join('- ' + line for line in sorted(changed)) + print(text) + + if 'CI' in os.environ: + text = '## Changed requirement files:\n\n' + text + print() + print('::set-output name=changed::' + text.replace('\n', '%0A')) + + def main(): """Re-compile the given (or all) requirement files.""" args = parse_args() @@ -217,6 +241,8 @@ def main(): with tempfile.TemporaryDirectory() as tmpdir: init_venv(host_python, tmpdir, outfile) + print_changed_files() + if __name__ == '__main__': main()