Files
webstudio/.github/workflows/delete-github-deployments.yml
Ivan Starkov f7487fd1bc chore: New Builder Auth (#4010)
## Description

### Full track


https://github.com/webstudio-is/webstudio-saas/issues/317#issuecomment-2289241819

So thoughts about session

https://github.com/webstudio-is/webstudio-saas/issues/317#issuecomment-2314515772

Some explanations what is fixed and how

https://github.com/webstudio-is/webstudio-saas/issues/317#issue-2465048823

Next PR:
- [x] - Old share links auto redirect
- [x] - Try make better error message having that current PR will logout
all users.

## Steps for reproduction

1. Login using `google login` or `dev login` try to open projects on
dahsboard, create new, clone delete etc.
2. Try to open projects on dahboard, see each is on it's own domain and
work
3. Try to open project link (without share token) with other user -
should fail.
4. Try publish/clone any links and operations.
5. Share project from `userA`:
 - try to open it with other `userB`
   - see `userB` is not logged in to that project
- try to get using fetch from console anything about `userB` or `userA`
i.e rest etc endpoints on apps.webstudio.is domain
 - try to open incognito, check it works.
6. Open few project, then logout from dashboard, reload project page
 - See login page
 - Try to login as same uer - see it works
 - Or try to login as another user - see auth error


## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-08-29 12:38:39 +03:00

53 lines
1.4 KiB
YAML

# https://github.com/orgs/community/discussions/36919
name: Delete github deployments
on:
workflow_call:
inputs:
ref:
type: string
required: true
permissions:
deployments: write
jobs:
delete_github_deployments:
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Delete Previous deployments
uses: actions/github-script@v7
env:
REF: ${{ inputs.ref }}
with:
script: |
const { REF } = process.env;
console.log(REF);
const deployments = await github.rest.repos.listDeployments({
owner: context.repo.owner,
repo: context.repo.repo,
ref: REF,
per_page: 100
});
console.log(deployments);
await Promise.allSettled(
deployments.data.map(async (deployment) => {
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id,
state: 'inactive'
});
return github.rest.repos.deleteDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id
});
})
);