removed thing #100
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
| name: ghstack land | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| ghstack_land: | |
| if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/land') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Show Environment Variables | |
| run: env | |
| - uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.PRIVATE_KEY }} | |
| - name: Add reaction to comment | |
| run: | | |
| COMMENT_ID=$(echo "${{ github.event.comment.id }}") | |
| REPO="${{ github.repository }}" | |
| curl -X POST \ | |
| -H "Authorization: token ${{ steps.app-token.outputs.token }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/repos/$REPO/issues/comments/$COMMENT_ID/reactions" \ | |
| -d '{"content":"rocket"}' | |
| - name: Show Github Object | |
| run: | | |
| cat <<'EOF' | |
| ${{ toJson(github) }} | |
| EOF | |
| - name: Show Github Event Path Json | |
| run: 'cat $GITHUB_EVENT_PATH || true' | |
| - name: Get PR details | |
| id: get-pr | |
| run: | | |
| PR_NUMBER=${{ github.event.issue.number }} | |
| echo "PR number is $PR_NUMBER" | |
| echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
| # Get PR details using GitHub API | |
| PR_DATA=$(curl -s \ | |
| -H "Authorization: token ${{ steps.app-token.outputs.token }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| "${{ github.api_url }}/repos/${{ github.repository }}/pulls/$PR_NUMBER") | |
| # Extract useful information | |
| PR_HEAD_REF=$(echo "$PR_DATA" | jq -r .head.ref) | |
| PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r .head.sha) | |
| PR_URL="${{ github.server_url }}/${{ github.repository }}/pull/$PR_NUMBER" | |
| echo "pr_branch=$PR_HEAD_REF" >> $GITHUB_OUTPUT | |
| echo "pr_sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT | |
| echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT | |
| echo "pr_branch=$PR_HEAD_REF" | |
| echo "pr_sha=$PR_HEAD_SHA" | |
| echo "pr_url=$PR_URL" | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| fetch-depth: '0' | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.9 | |
| - name: Check Current CI Status | |
| run: | | |
| pip install requests ghstack | |
| echo ${{ github.event.issue.number }} | |
| .github/workflows/scripts/ghstack-perm-check.py ${{ github.event.issue.number }} ${{steps.get-pr.outputs.pr_branch}} ${{ github.repository }} | |
| EOF | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Land It! | |
| run: | | |
| git config --global user.email "bot@thinkingmachines.ai" | |
| git config --global user.name "ghstack bot" | |
| cat <<EOF > ~/.ghstackrc | |
| [ghstack] | |
| github_url = github.com | |
| github_oauth = $GITHUB_TOKEN | |
| github_username = foo | |
| remote_name = origin | |
| EOF | |
| ghstack land "${{ steps.get-pr.outputs.pr_url }}" | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |