Add Github workflow on copybara import
When the import/copybara status check succeeds, post a comment on the PR directing developers to see the imported CL on Gerrit.
Unfortunately, it is not possible to test this workflow until it lands, so a debugging job is included as well which will be removed in the future.
This is an imported pull request from
https://github.com/google/dawn/pull/7
GITHUB_PR_HEAD_SHA=3a51c4f011ca9afc803c65a2a37862b91692d1ae
ORIGINAL_AUTHOR=Austin Eng <2154796+austinEng@users.noreply.github.com>
GitOrigin-RevId: 29714141a9342ad16b218d84c818298bd3636fb4
Change-Id: I8c6501f8fce8f652951a6280947976e554b52f75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/158683
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Kokoro: Austin Eng <enga@chromium.org>
diff --git a/.github/workflows/on-copybara-import.yml b/.github/workflows/on-copybara-import.yml
new file mode 100644
index 0000000..3eb6516
--- /dev/null
+++ b/.github/workflows/on-copybara-import.yml
@@ -0,0 +1,37 @@
+name: On copybara import
+
+on:
+ status
+
+jobs:
+ debug:
+ name: debug
+ runs-on: ubuntu-latest
+ steps:
+ name: Dump Github Context
+ run: echo '${{ toJSON(github) }}'
+
+ comment:
+ name: comment
+ if: github.event.state == 'success' && github.event.context == 'import/copybara'
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: Find PR
+ uses: sharesight/find-github-pull-request@1.2.0
+ with:
+ commitSha: ${{ github.event.sha }}
+ allowClosed: false
+ failIfNotFound: false
+
+ - name: Comment on PR
+ if: steps.find-pr.outputs.number != ''
+ uses: marocchino/sticky-pull-request-comment@v2
+ with:
+ number: ${{ steps.find-pr.outputs.number }}
+ header: pr_was_imported # key to reuse the same comment
+ message: |
+ 👋 Thanks for your contribution! Your PR has been imported to Gerrit.
+ Please visit ${{ github.event.target_url }} to see it and CC yourself on the change.
+ All comments are handled within Gerrit. Any comments on the GitHub PR may be ignored.
+ You can continue to upload commits to the PR in order to address feedback from Gerrit.