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

Add a job to warn about modulesync changes #727

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
52 changes: 52 additions & 0 deletions moduleroot/.github/workflows/modulesync.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

name: Modulesync

on: pull_request

jobs:
compare_with_repo:
name: 'Compare with config'
runs-on: ubuntu-latest
steps:
- name: Checkout Puppet module repository
uses: actions/checkout@v2
with:
path: modules/${{ github.repository }}

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Set modulesync version
run: ruby -ryaml -e 'puts "MSYNC_VER=#{YAML.safe_load(File.read(".msync.yml"))["modulesync_config_version"]}"' >> $GITHUB_ENV
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break with pre-release like in voxpupuli/puppet-telegraf#174. Perhaps we need to update our .msync.yml file to write git describe there instead of hardcoding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the question is do we want to support prereleases, or do we want to be more strict with modulesync_config releases? I'm not sure here.

working-directory: modules/${{ github.repository }}

- name: Checkout modulesync configuration repository
uses: actions/checkout@v2
with:
# TODO: is there a modulesync variable for this?
repository: voxpupuli/modulesync_config
ref: ${{ env.MSYNC_VER }}
path: msync_config

- name: Create a temporary managed modules file
run: echo "- $GITHUB_REPOSITORY" > msync_config/pr-managed-modules.yaml

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
working-directory: msync_config

- name: Run modulesync
run: bundle exec msync update --offline --managed-modules-conf=pr-managed-modules.yaml --project-root=../modules
working-directory: msync_config

- name: Check for differences
run: git diff --exit-code
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we need to run git add . && git diff --cached --exit-code to also track added/removed files

working-directory: modules/${{ github.repository }}