-
-
Notifications
You must be signed in to change notification settings - Fork 306
chore: add an action that on labeled bless blesses the PR #2202
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
Draft
CommanderStorm
wants to merge
17
commits into
maplibre:main
Choose a base branch
from
CommanderStorm:bless-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a6a73f4
add an action that on labeled bless blesses the PR
CommanderStorm 993d3b9
test
CommanderStorm 1224a61
test
CommanderStorm 8ca207d
install just just
CommanderStorm db063f2
test
CommanderStorm 3de2f86
don't prematurely celebrate
CommanderStorm e46025a
test different checkout
CommanderStorm 54c4dd1
tmp change trigger
CommanderStorm bbc3917
Revert "tmp change trigger"
CommanderStorm 8d70d29
adapt to nyurik/action-setup-postgis
CommanderStorm 062db79
test alternative
CommanderStorm 3db274e
Revert "test alternative"
CommanderStorm 641e907
tmp change checkout
CommanderStorm 021c8ad
test slightly different tactinc
CommanderStorm 63cb896
different syntax
CommanderStorm 8de403b
test different templating
CommanderStorm 00e6206
test if this is what we want
CommanderStorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| name: Bless Test Output | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| bless: | ||
| name: Bless test output | ||
| runs-on: ubuntu-latest | ||
| if: contains(github.event.label.name, 'bless') | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
|
||
| - name: Setup Rust | ||
| run: rustup update stable && rustup default stable | ||
|
|
||
| - name: Install just | ||
| uses: taiki-e/install-action@cc60de1d6831d7e9c4342f618ce7a5d6a9f223a4 # v2.61.6 | ||
| with: | ||
| tool: just,cargo-binstall | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | ||
|
|
||
| - name: Install frontend dependencies | ||
| run: npm install | ||
| working-directory: martin/martin-ui | ||
|
|
||
| - name: Setup PostgreSQL | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y postgresql postgresql-contrib postgis | ||
| sudo systemctl start postgresql | ||
| sudo -u postgres createuser -s $USER | ||
| sudo -u postgres createdb test | ||
| sudo -u postgres psql -c "ALTER USER $USER WITH PASSWORD 'postgres';" | ||
|
|
||
| - name: Setup NGINX | ||
| uses: nyurik/action-setup-nginx@612ee9cb839ad727832cda16359452e7e14dd521 # v1.1 | ||
| id: nginx | ||
|
|
||
| - name: Copy static test files | ||
| run: cp -r tests/fixtures/pmtiles2/* ${{ steps.nginx.outputs.html-dir }} | ||
|
|
||
| - name: Initialize database | ||
| run: tests/fixtures/initdb.sh | ||
| env: | ||
| PGPORT: 5432 | ||
| PGHOST: localhost | ||
| PGUSER: ${{ github.actor }} | ||
| PGPASSWORD: postgres | ||
| PGDATABASE: test | ||
|
|
||
| - name: Install system dependencies | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is a near-perfect dup of all the setup steps, could we just move all the common setup logic to a private action -- see exampls in https://github.com/maplibre/maplibre-rs/tree/main/.github/actions/setup |
||
| run: sudo apt-get install -y gdal-bin sqlite3-tools | ||
|
|
||
| - name: Run just bless | ||
| run: just bless | ||
| env: | ||
| DATABASE_URL: postgres://${{ github.actor }}:postgres@localhost:5432/test | ||
| PGPORT: 5432 | ||
| PGHOST: localhost | ||
| PGUSER: ${{ github.actor }} | ||
| PGPASSWORD: postgres | ||
| PGDATABASE: test | ||
|
|
||
| - name: Commit blessed output | ||
| id: commit | ||
| run: | | ||
| git config --local user.email "[email protected]" | ||
| git config --local user.name "GitHub Action (bless)" | ||
| git add -A | ||
| if ! git diff --cached --quiet; then | ||
| git commit -m "Bless test output [skip ci]" | ||
| git push | ||
| echo "✅ Test output blessed and committed" | ||
| echo "changes_made=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "ℹ️ No changes to commit" | ||
| echo "changes_made=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Remove bless label | ||
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 | ||
| with: | ||
| script: | | ||
| await github.rest.issues.removeLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| name: 'bless' | ||
| }); | ||
|
|
||
| - name: Add comment | ||
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 | ||
| with: | ||
| script: | | ||
| const changesMade = '${{ steps.commit.outputs.changes_made }}' === 'true'; | ||
| const body = changesMade | ||
| ? 'Test output has been blessed. Please review the changed files.' | ||
| : 'Blessing test output yielded no changes.'; | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: body | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.