|
| 1 | +--- |
| 2 | +name: Update all Puppet modules |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: {} |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + |
| 10 | +env: |
| 11 | + GIT_AUTHOR_NAME: pccibot |
| 12 | + GIT_AUTHOR_EMAIL: [email protected] |
| 13 | + GIT_COMMITTER_NAME: pccibot |
| 14 | + GIT_COMMITTER_EMAIL: [email protected] |
| 15 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 16 | + GITHUB_BASE_URL: https://api.github.com |
| 17 | + |
| 18 | +jobs: |
| 19 | + unit: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + name: Run msync against all modules |
| 22 | + if: github.repository_owner == voxpupuli |
| 23 | + steps: |
| 24 | + - name: checkout code |
| 25 | + # the action has a ssh-key option. |
| 26 | + # when provided, it configures the ssh/git config to authenticate automatically with that key to the source repo |
| 27 | + # the authentication won't be used for other repos (which we need for msync), so we cannot use the option |
| 28 | + # that's the reason for the 'Add SSH key' step |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + - name: Setup ruby |
| 33 | + uses: ruby/setup-ruby@v1 |
| 34 | + with: |
| 35 | + ruby-version: 3.4 |
| 36 | + bundler-cache: true |
| 37 | + - name: Add SSH key |
| 38 | + run: | |
| 39 | + mkdir -p ~/.ssh |
| 40 | + echo "${{ secrets.PCCI_SSH_PRIVATE_KEY }}" > ~/.ssh/github_actions |
| 41 | + chmod 600 ~/.ssh/github_actions |
| 42 | + ssh-agent -a $SSH_AUTH_SOCK > /dev/null |
| 43 | + ssh-add ~/.ssh/github_actions |
| 44 | + - name: set git user & email & commit signing |
| 45 | + run: | |
| 46 | + git config --global user.email "$GIT_AUTHOR_EMAIL" |
| 47 | + git config --global user.name "$GIT_AUTHOR_NAME" |
| 48 | + git config --global gpg.format ssh |
| 49 | + git config --global user.signingkey ~/.ssh/github_actions |
| 50 | + git config --global commit.gpgsign true |
| 51 | + - name: Run msync |
| 52 | + env: |
| 53 | + # https://github.com/voxpupuli/modulesync?tab=readme-ov-file#submitting-prsmrs-to-github-or-gitlab |
| 54 | + GITHUB_TOKEN: '${{ secrets.PCCI_PAT_MODULESYNC_PR }}' |
| 55 | + run: | |
| 56 | + bundle exec msync update --verbose \ |
| 57 | + --pr \ |
| 58 | + --pr-labels modulesync \ |
| 59 | + --pr-title "modulesync $(git describe)" \ |
| 60 | + --message "modulesync $(git describe)" |
0 commit comments