Update ci.yml #85
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: Changed Data Files | ||
on: | ||
push: | ||
branches: | ||
- dev/test/api | ||
paths: | ||
- '.github/workflows/**' | ||
- 'src/_data/**.js' | ||
- 'src/_data/**.yml' | ||
- 'src/pages/api/**.njk' | ||
- 'src/_includes/modules/api-config.njk' | ||
- 'src/_includes/modules/components/**' | ||
env: | ||
TEMP_BRANCH: ${{ TEMP_BRANCH }} | ||
Check failure on line 16 in .github/workflows/ci.yml GitHub Actions / Changed Data FilesInvalid workflow file
|
||
BASE_BRANCH: ${{ BASE_BRANCH }} | ||
DEST_BRANCH: ${{ DEST_BRANCH }} | ||
CI_COMMIT_AUTHOR: ${{ vars.CI_COMMIT_AUTHOR }} | ||
CI_COMMIT_EMAIL: ${{ vars.CI_COMMIT_EMAIL }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
jobs: | ||
automatic-pr: | ||
runs-on: ubuntu-latest | ||
name: Automatic PR | ||
steps: | ||
- name: checkout specific files | ||
id: checkout-files | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ env.DEST_BRANCH }} | ||
- name: Get current time | ||
uses: josStorer/get-current-time@v2 | ||
id: current-time | ||
with: | ||
format: YYYYMMDD-HHMMSS | ||
timezone: America/New_York | ||
- name: set commit/pr message | ||
id: message | ||
run: | | ||
title="✅ CI: automatically update ${{ env.DEST_BRANCH }} from ${{ env.BASE_BRANCH }} 🙌📟🎉" | ||
body="🚀 Automated PR created via Github action by ${{ env.CI_COMMIT_AUTHOR }} :octocat: on ${{ steps.current-time.outputs.readableTime }} 📅⏳" | ||
echo "title=$title" >> $GITHUB_OUTPUT | ||
echo "body=$body" >> $GITHUB_OUTPUT | ||
- name: create branch from destination branch and checkout files from base branch | ||
id: new-branch | ||
run: | | ||
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" | ||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | ||
git fetch origin | ||
git push -d origin $env.TEMP_BRANCH &>/dev/null || true | ||
git branch -d $env.TEMP_BRANCH &>/dev/null || true | ||
git checkout -b $env.TEMP_BRANCH | ||
git checkout $env.BASE_BRANCH -- .github/workflows src/_data src/pages/api src/_includes/modules/api-config.njk src/_includes/modules/components | ||
git add -A | ||
git commit -m "${{ steps.message.outputs.title }}" | ||
git push --set-upstream origin $env.TEMP_BRANCH | ||
- name: create pull request | ||
run: gh pr create -B $env.DEST_BRANCH -H $env.TEMP_BRANCH --title "${{ steps.message.outputs.title }}" --body "${{ steps.message.outputs.body }}" --draft --label "automation" --reviewer "rediris" |