Skip to content

CI

CI #785

Workflow file for this run

name: CI
on:
schedule:
- cron: '0 0 * * *' # run every day at midnight
push:
branches:
- main
merge_group:
pull_request:
branches:
- main
jobs:
test-latest:
name: Test changed-files latest tag
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
fetch-depth: [0, 1, 2]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- run: |
echo "id=$(git merge-base $GITHUB_EVENT_PULL_REQUEST_BASE_SHA $GITHUB_SHA)" >> $GITHUB_OUTPUT
env:
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_SHA: ${{ github.sha }}
shell: bash
id: merge_base
if: always()
- run: |
echo "The merge base of the current branch and the base branch is: ${{ steps.merge_base.outputs.id }}"
shell: bash
if: always()
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
- name: Get changed files in the .github folder
id: changed-files-specific
uses: tj-actions/changed-files@v44
with:
files: .github/**
- name: Run step if any file(s) in the .github folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files in the .github folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
test-main:
name: Test changed-files main
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
fetch-depth: [0, 1, 2]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- run: git remote -v
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@main
- run: |
echo "id=$(git merge-base $GITHUB_EVENT_PULL_REQUEST_BASE_SHA $GITHUB_SHA)" >> $GITHUB_OUTPUT
if: github.event_name == 'pull_request' && always()
env:
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_SHA: ${{ github.sha }}
shell: bash
id: merge_base
- run: |
echo "The merge base of the current branch and the base branch is: ${{ steps.merge_base.outputs.id }}"
shell: bash
if: always()
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files.outputs) }}'
shell:
bash
- name: Get changed files in the .github folder
id: changed-files-specific
uses: tj-actions/changed-files@main
with:
files: .github/**
- name: Run step if any file(s) in the .github folder change
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files in the .github folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"