Skip to content

Create tech stack docs (techstack.yml and techstack.md) #2

Create tech stack docs (techstack.yml and techstack.md)

Create tech stack docs (techstack.yml and techstack.md) #2

Workflow file for this run

name: shadow pr
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
open-pr:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.pull_request.body, '<!-- from mono -->') != true }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get all commit authors of pull request
uses: actions/github-script@v3
id: commit-authors
with:
github-token: ${{secrets.HASURA_BOT_GH_TOKEN}}
script: |
const pullRequestNumber = context.payload.number;
const commits = await github.pulls.listCommits({
owner: 'hasura',
repo: 'graphql-engine',
pull_number: pullRequestNumber
});
if (commits.status != 200) {
core.setFailed('API request to get commits of pull request returned non-success status code ' + commits.status);
return;
}
let authors = commits.data.map(function(c) { return `${c.commit.author.name} <${c.commit.author.email}>`; });
authors = Array.from(new Set(authors));
authors = authors.join(',');
core.setOutput('allCommitAuthors', authors);
- name: "Shadow pull request"
env:
PR_NUMBER: ${{ github.event.number }}
GH_USERNAME: hasura-bot
GH_CREDS: $GH_USERNAME:${{ secrets.HASURA_BOT_GH_TOKEN }}
GH_SSH_KEY: ${{ secrets.HASURA_BOT_SSH_KEY }}
GH_BASE_REPO_HEAD_SHA: ${{ github.event.pull_request.base.sha }}
ALL_COMMIT_AUTHORS: ${{ steps.commit-authors.outputs.allCommitAuthors }}
run: |
touch .git-credentials
echo "https://[email protected]" >> .git-credentials
echo "https://[email protected]" >> .git-credentials
mkdir .ssh
echo "$GH_SSH_KEY" | tr -d '\r' > .ssh/id_rsa
chmod 400 .ssh/id_rsa
ssh-keyscan -t rsa github.com > .ssh/known_hosts
docker run --rm \
-v ${PWD}/.git-credentials:/root/.git-credentials \
-v ${PWD}/.ssh:/root/.ssh \
-v ${PWD}/.github/workflows/bot.gitconfig:/root/.gitconfig \
-v ${PWD}/.github/workflows:/usr/src/app \
--env COPYBARA_CONFIG=copy.bara.sky \
--env COPYBARA_SUBCOMMAND=migrate \
--env COPYBARA_OPTIONS="--ignore-noop --last-rev $GH_BASE_REPO_HEAD_SHA" \
--env COPYBARA_WORKFLOW="shadow-pr" \
--env COPYBARA_SOURCEREF=$PR_NUMBER \
--env ALL_COMMIT_AUTHORS="$ALL_COMMIT_AUTHORS" \
ghcr.io/scriptnull/copybara:latest copybara