Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI job for fixture regeneration #80

Merged
merged 21 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
91be247
ci: add fixture regeneration CI job
ryan-gang Dec 23, 2024
20ba853
feat: add git push capabilities
ryan-gang Dec 23, 2024
b60c4d6
feat: add CI action URL to comment
ryan-gang Dec 23, 2024
ca09db7
fix: update yaml indentation
ryan-gang Dec 23, 2024
be98bdc
fix: update actions URL in comment
ryan-gang Dec 23, 2024
0cb2db3
chore: update random small word generator list
ryan-gang Dec 23, 2024
56c4f89
ci: add git checkout step to fixture regeneration workflow
ryan-gang Dec 23, 2024
3a4800c
fix: update git checkout reference in CI workflow to use head_ref
ryan-gang Dec 23, 2024
f13675e
ci: fetch origin head_ref before checkout in fixture regeneration wor…
ryan-gang Dec 23, 2024
91f3f05
ci: add write permissions for contents in fixture regeneration workflow
ryan-gang Dec 23, 2024
8a984dc
ci: reorder steps in fixtures pipeline
ryan-gang Dec 23, 2024
d14597a
ci: remove unnecessary write permissions from fixture regeneration wo…
ryan-gang Dec 23, 2024
5ed1d26
ci: add write permissions for pull-requests in fixture regeneration w…
ryan-gang Dec 23, 2024
c9f6cf9
ci: add regenerated fixtures
ryan-gang Dec 23, 2024
00bc340
ci: trigger test run
ryan-gang Dec 23, 2024
bd388db
chore: update token used for pushing updated fixtures
ryan-gang Dec 27, 2024
ebba2b8
ci: add regenerated fixtures
ryan-gang Dec 27, 2024
efd894b
chore: update GitHub Actions workflow
ryan-gang Dec 27, 2024
2105bb4
ci: add regenerated fixtures
ryan-gang Dec 27, 2024
7160795
chore: revert changes to random word generation
ryan-gang Dec 27, 2024
77f8b0b
ci: add regenerated fixtures
ryan-gang Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Trigger Fixture Regeneration

on:
pull_request:
types:
- labeled

permissions:
contents: write
pull-requests: write

jobs:
trigger_pipeline:
if: github.event.label.name == 'regenerate-fixtures'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.RYAN_FIXTURE_GEN_PAT }}

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.22.x

- uses: actions-ecosystem/action-create-comment@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
body: |
Triggered a [Github Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) job to update fixtures.

- uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: regenerate-fixtures

- name: Regenerate Fixtures
run: CODECRAFTERS_RECORD_FIXTURES=true make test

- name: Update Fixtures
run: |
git config --global user.email "[email protected]"
git config --global user.name "Ryan Gang"
git remote set-url origin https://ryan-gang:${{ secrets.RYAN_FIXTURE_GEN_PAT }}@github.com/codecrafters-io/shell-tester.git
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git diff --quiet || (git add . && git commit -m "ci: add regenerated fixtures" && git push)
Loading