Skip to content

Commit

Permalink
[Gitar] Apply gitar duet on top of gitar bot PRs (#8141)
Browse files Browse the repository at this point in the history
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes

When working with automated changes made by the @gitar-bot , custom
automated changes may be necessary. For example,

- Running lint auto-fixes
- Executing code generation
- Updating test snapshot files
- Running internal tools

Gitar recommends these in a separate CI pipeline. We call this [Gitar
Duet](https://gitar.co/docs/more/custom-automated-changes/), where
custom tools run alongside Gitar’s automated changes.

### Important files
github ci workflow files

## Discussion points
Feel free to update the workflow to modify the autofix steps
  • Loading branch information
kageiit authored Sep 16, 2024
1 parent 85522e0 commit 77ea596
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/gitar-duet-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Gitar Duet

on:
push:
branches:
- 'gitar_*'

jobs:
gitar-duet:
if: github.event.head_commit.author.name == 'Gitar'
runs-on: ubuntu-latest
name: Gitar Duet
permissions:
contents: write # Required to update with Gitar Duet changes

steps:
- run: |
echo '${{ toJSON(github.event) }}'
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'

- name: Enable corepack
run: corepack enable

- run: yarn install --immutable
env:
YARN_ENABLE_SCRIPTS: false

- run: |
yarn run biome check --fix --unsafe || true # Run unsafe auto-fixes
yarn lint:fix || true # Fix linting issues
- run: yarn test:updateSnapshot || true # Update test snapshots

- run: |
# Undo deletes for snapshots
git reset
git diff --diff-filter=D --name-only HEAD | xargs git checkout HEAD^ --
- name: Run Gitar Duet Action
uses: gitarcode/gitar-duet-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"test:watch": "yarn test --watch",
"test:coverage": "NODE_ENV=test PORT=4243 jest --coverage --testLocationInResults --outputFile=\"coverage/report.json\" --forceExit --testTimeout=10000",
"test:coverage:jest": "NODE_ENV=test PORT=4243 jest --silent --ci --json --coverage --testLocationInResults --outputFile=\"report.json\" --forceExit --testTimeout=10000",
"test:updateSnapshot": "NODE_ENV=test PORT=4243 jest --updateSnapshot --testTimeout=10000",
"seed:setup": "ts-node --compilerOptions '{\"strictNullChecks\": false}' src/test/e2e/seed/segment.seed.ts",
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev",
"clean": "del-cli --force dist",
Expand Down Expand Up @@ -247,4 +248,4 @@
]
},
"packageManager": "[email protected]"
}
}

0 comments on commit 77ea596

Please sign in to comment.