Skip to content

Commit 9b88fa5

Browse files
authored
Merge pull request #933 from Kotlin/muted-gh-action-bot
Muted gh action bot
2 parents f410705 + b47dd68 commit 9b88fa5

File tree

3 files changed

+22
-42
lines changed

3 files changed

+22
-42
lines changed
Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: Show generated code in PR
1+
name: Preview Generated Code
2+
3+
permissions:
4+
contents: write
5+
statuses: write
26

37
on:
48
pull_request:
@@ -10,16 +14,15 @@ on:
1014
- ready_for_review
1115

1216
jobs:
13-
build:
17+
build_preview_generated_code:
18+
name: Build Preview of Generated Code
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
1422
runs-on: ubuntu-latest
1523
env:
1624
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1725
steps:
18-
- name: Cancel Previous Runs
19-
uses: styfle/[email protected]
20-
with:
21-
access_token: ${{ github.token }}
22-
2326
- name: Checkout repository
2427
uses: actions/checkout@v4
2528

@@ -39,7 +42,7 @@ jobs:
3942

4043
- name: Check for changes in generated sources
4144
id: git-diff
42-
run: echo "::set-output name=changed::$(if git diff --quiet './core/generated-sources' './docs/StardustDocs/snippets' './docs/StardustDocs/topics'; then echo 'false'; else echo 'true'; fi)"
45+
run: echo "changed=$(if git diff --quiet './core/generated-sources' './docs/StardustDocs/snippets' './docs/StardustDocs/topics'; then echo 'false'; else echo 'true'; fi)" >> $GITHUB_OUTPUT
4346

4447
- name: Commit and push if changes
4548
id: git-commit
@@ -49,44 +52,21 @@ jobs:
4952
git add './core/generated-sources' './docs/StardustDocs/snippets' './docs/StardustDocs/topics'
5053
git commit -m "Update generated sources with recent changes"
5154
git push origin generated-sources/docs-update-${{ github.run_number }}
52-
echo "::set-output name=commit::$(git rev-parse HEAD)"
53-
54-
- name: Remove old comments
55-
uses: actions/github-script@v7
56-
if: steps.git-diff.outputs.changed == 'true'
57-
with:
58-
# language=js
59-
script: |
60-
const issue_number = context.issue.number;
61-
const {owner, repo} = context.repo;
62-
63-
const comments = await github.rest.issues.listComments({
64-
issue_number,
65-
owner,
66-
repo,
67-
});
68-
69-
const botComments = comments.data.filter(
70-
(comment) => comment.user.login === 'github-actions[bot]'
71-
);
72-
73-
for (const comment of botComments) {
74-
await github.rest.issues.deleteComment({
75-
comment_id: comment.id,
76-
owner,
77-
repo,
78-
});
79-
}
55+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
8056
81-
- name: Add comment to PR
57+
- name: Update status to PR
8258
uses: actions/github-script@v7
8359
if: steps.git-diff.outputs.changed == 'true'
8460
with:
8561
# language=js
8662
script: |
87-
github.rest.issues.createComment({
88-
issue_number: context.issue.number,
63+
await github.rest.repos.createCommitStatus({
8964
owner: context.repo.owner,
9065
repo: context.repo.repo,
91-
body: "Generated sources will be updated after merging this PR.\nPlease inspect the changes in [here](https://github.com/${{ github.repository }}/commit/${{ steps.git-commit.outputs.commit }}).",
66+
sha: context.payload.pull_request.head.sha,
67+
state: "success",
68+
target_url: "https://github.com/${{ github.repository }}/commit/${{ steps.git-commit.outputs.commit }}",
69+
context: "Generated sources will change, merging this PR",
70+
description: "Check 'Details' to inspect changes ->"
9271
});
72+

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ so do familiarize yourself with the following guidelines.
6060
4. The contributor answers the comments or fixes the proposed PR.
6161
5. The reviewer marks the PR with the word "LGTM."
6262
6. The maintainer could suggest merging the `master` branch to the PR branch a few times due to changes in the `master` branch.
63-
7. If the PR influences generated code/samples, a bot will inform about this in the PR comments.
63+
7. If the PR influences generated code/samples, a bot will inform about this in the PR checks.
6464
8. The maintainer runs TeamCity builds (unit tests and examples as integration tests).
6565
9. TeamCity writes the result (passed or not passed) to the PR checks at the bottom of the proposed PR.
6666
10. If it is possible, maintainers share the details of the failed build with the contributor.

KDOC_PREPROCESSING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ This can be seen in action in the `core:processKDocsMain` and `core:changeJarTas
5858
To make sure the generated sources can be seen and reviewed on GitHub,
5959
since [PR #731](https://github.com/Kotlin/dataframe/pull/731),
6060
there's a [GitHub action](.github/workflows/generated-sources.yml) that runs the `core:processKDocsMain` task and
61-
comments the results on the PR. After a PR is merged, [another action](.github/workflows/generated-sources-master.yml)
61+
shows the results in the PR checks. After a PR is merged, [another action](.github/workflows/generated-sources-master.yml)
6262
runs on the master branch and commits the generated sources automatically.
6363
This way, the generated sources are always up to date with the latest changes in the code.
6464
This means you don't have to run and commit the generated sources yourself, though it's

0 commit comments

Comments
 (0)