Skip to content

Expose ignore_access and ignore_restrictions API flags #47

Expose ignore_access and ignore_restrictions API flags

Expose ignore_access and ignore_restrictions API flags #47

Workflow file for this run

name: PR preview
on:
pull_request:
types: [opened, reopened, synchronize, closed]
paths:
- 'src/**'
- 'public/**'
- 'package*.json'
- '.env'
- 'jsconfig.json'
- '.github/workflows/preview.yml'
env:
PULL_NUMBER: ${{ github.event.pull_request.number }}
jobs:
clean-up:
runs-on: ubuntu-latest
if: ${{ github.event.action == 'closed' }}
steps:
- name: 🧹 Remove preview dir
run: |
eval $(ssh-agent -s)
ssh-add - <<< "${{ secrets.PREVIEW_SSH_PRIVATE_KEY }}"
ssh -o StrictHostKeyChecking=no ${{ vars.PREVIEW_HOST_USERNAME }}@${{ vars.PREVIEW_HOST_IP }} "rm -rf ${{ vars.PREVIEW_HOST_TARGET_DIR }}/$PULL_NUMBER"
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.action != 'closed' }}
steps:
- uses: actions/checkout@v3
- name: 🏠 Replace homepage URL
run: sed -i "s/https:\/\/valhalla.openstreetmap.de/https:\/\/valhalla-app-tests.gis-ops.com\/${PULL_NUMBER}/g" package.json
- uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: 🔧 Create build
run: |
npm install
npm run build
- name: 🚀 Preview deploy
run: |
eval $(ssh-agent -s)
ssh-add - <<< "${{ secrets.PREVIEW_SSH_PRIVATE_KEY }}"
rsync -r --delete --rsync-path="mkdir -p ${{ vars.PREVIEW_HOST_TARGET_DIR }}/$PULL_NUMBER && rsync" -e "ssh -o StrictHostKeyChecking=no" ./build/ ${{ vars.PREVIEW_HOST_USERNAME }}@${{ vars.PREVIEW_HOST_IP }}:${{ vars.PREVIEW_HOST_TARGET_DIR }}/$PULL_NUMBER
- name: 🌐 Preview URL
if: ${{ success() }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT }}
script: |
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const existingComment = comments.find(comment => comment.body.includes('Preview is ready! 🚀'));
if (!existingComment) {
const body = `Preview is ready! 🚀 You can view it here: https://valhalla-app-tests.gis-ops.com/${{ github.event.pull_request.number }}`;
const { data } = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
console.log('Comment created successfully');
} else {
console.log('Comment already exists');
}