adjust management of dates 2 #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate JSON on Push or PR | |
on: [workflow_dispatch, push] | |
jobs: | |
generate-json: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: ${{ github.actor != 'github-actions[bot]' && github.event_name != 'push' || github.event.pusher.name != 'github-actions[bot]' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # needed for full meta history | |
- name: Set git config | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '[email protected]' | |
git config --global core.quotePath false | |
- name: get inputs for job | |
# note the herdocs for multiline outputs | |
run: | | |
# Collect all files | |
all_files=$(git ls-tree -r --name-only HEAD) | |
echo "all_files<<EOF" >> $GITHUB_ENV | |
echo "$all_files" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
# Collect modified files | |
files_modified=$(git diff --name-only HEAD~1 HEAD) | |
echo "files_modified<<EOF" >> $GITHUB_ENV | |
echo "$files_modified" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
# Read metadata.json | |
existing_meta=$(cat metadata.json) | |
echo "existing_meta<<EOF" >> $GITHUB_ENV | |
echo "$existing_meta" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Run dates.js | |
uses: ./actions/dates | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
all-files: ${{ env.all_files }} | |
files-modified: ${{ env.files_modified }} | |
existing-meta: ${{ env.existing_meta }} |