Skip to content

Workflow file for this run

name: Lock Dependency
on:
push:
# Ensure obsolete job is cancelled if another commit is pushed to the same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr:
runs-on: ubuntu-latest
outputs:
pr_found: ${{ steps.pr.outputs.pr_found }}
steps:
# Only execute if there's a PR attached to this branch.
# Because we execute on `push`, we have to double check here if this is part of a PR.
- name: Check if this branch is attached to a Pull Request
uses: 8BitJonny/[email protected]
id: pr
with:
filterOutClosed: true # Don't trigger on commits with closed PRs, including merges into `master`.
- if: steps.pr.outputs.pr_found == 'true'
run: |
echo ${{ fromJSON(steps.pr.outputs) }}
dependency:
needs: pr
if: ${{ needs.pr.outputs.pr_found == 'true' }}
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changes.outputs.gemfile }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref_name }}
filters: .github/filters.yml
lock:
runs-on: ubuntu-latest
needs: dependency
if: ${{ needs.dependency.outputs.changes == 'true' }}
strategy:
fail-fast: false
matrix:
engine:
# ADD NEW RUBIES HERE
- name: ruby
version: '3.4'
- name: ruby
version: '3.3'
- name: ruby
version: '3.2'
- name: ruby
version: '3.1'
- name: ruby
version: '3.0'
- name: ruby
version: '2.7'
- name: ruby
version: '2.6'
- name: ruby
version: '2.5'
# - name: jruby
# version: '9.4'
# - name: jruby
# version: '9.3'
# - name: jruby
# version: '9.2'
container:
image: ghcr.io/datadog/images-rb/engines/${{ matrix.engine.name }}:${{ matrix.engine.version }}
env:
BUNDLE_WITHOUT: check
steps:
- uses: actions/checkout@v4
- run: ls -al
- run: |
ruby -v
gem -v
bundler -v
- run: bundle install
# TODO: Migrate away from `appraisal`
- run: bundle exec appraisal generate
- run: bundle exec rake dependency:lock
- uses: actions/upload-artifact@v4
with:
name: lock-dependency-${{ github.run_id }}-${{ matrix.engine.name }}-${{ matrix.engine.version }}
path: gemfiles/${{ matrix.engine.name }}_${{ matrix.engine.version }}*
commit:
needs: lock
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: gemfiles
pattern: lock-dependency-${{ github.run_id }}-*
merge-multiple: true
- run: git diff --color
- uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: 'gemfiles/*'
commit_message: "[🤖] Lock Dependency: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"