Skip to content

Commit

Permalink
update pr state
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 1, 2023
1 parent a40f1af commit 8dca6f6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/github-actions-es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ jobs:
run: go test -v ./... -tags ci

- name: Check build and test results
if: failure()
run: |
echo "FMT build and test failed. Please fix the issues before merging."
exit 1
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
if (job.status === 'failure') {
await github.pulls.updateBranch({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
expected_head_sha: pr.head.sha,
status: 'behind'
});
}
23 changes: 19 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,22 @@ jobs:
# install-mode: "goinstall"

- name: Check fmt results
if: failure()
run: |
echo "FMT check failed. Please fix the issues before merging."
exit 1
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
if (job.status === 'failure') {
await github.pulls.updateBranch({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
expected_head_sha: pr.head.sha,
status: 'behind'
});
}

0 comments on commit 8dca6f6

Please sign in to comment.