scripts: Add changed requirement files
This commit is contained in:
parent
b3a49eb0c2
commit
dae0a8002f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue