sourcegraph/.github/workflows/merge-pr.yml
Kalan c0ccde2ccf
docs: embeddings list automation (#52879)
This PR will merge and update the list of embedded repos we have on
sourcegraph.com. It uses the sourcegraph graphQL to pull a list of all
embedded repos, filters & sorts the list, and then updates the markdown
`embedded-repos.md`.


The update workflow will run everyday @ `0:00 UTC` and the automatic
merge follows @ `0:05 UTC`.


## Test plan
`npm test`

run locally:
1. get access from
[here](https://start.1password.com/open/i?a=HEDEDSLHPBFGRBTKAKJWE23XX4&v=dnrhbauihkhjs5ag6vszsme45a&i=za6swt25wax766z6pe7wpczxxe&h=team-sourcegraph.1password.com)
2. set access token `set SOURCEGRAPH_DOCS_ACCESS_TOKEN=<access_token>`
or hard code
`const access_token = <access_token>`
3. run `ts-node src/index.ts`

output should be embedded-repos.md
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

---------

Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
2023-06-05 15:30:34 -07:00

29 lines
731 B
YAML

name: Merge embeddings list updates
on:
schedule:
# everyday at 0:10 UTC
- cron: 10 0 * * *
workflow_dispatch: {}
permissions: write-all
jobs:
run:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.MERGE_PR_TOKEN_DEVX_BOT }}
steps:
- uses: actions/checkout@v3
- run: |
PR_NUMBER="$(gh pr list --label automerge --label embeddings-list-update --json number | jq -r '.[0].number')"
if [ "$PR_NUMBER" = "null" ]
then
echo "no oustanding PR...skipping"
exit 0
else
echo "approving PR"
gh pr review $PR_NUMBER --approve
echo "squashing PR: $PR_NUMBER"
gh pr merge $PR_NUMBER --auto --squash
fi