diff --git a/.github/workflows/context.yml b/.github/workflows/context.yml index c6f40d1d..9dce8c74 100644 --- a/.github/workflows/context.yml +++ b/.github/workflows/context.yml @@ -49,3 +49,14 @@ jobs: name: check if a pr has test label run: | echo "- github.event.pull_request.labels has 'test'" >> "$GITHUB_STEP_SUMMARY" + + - name: write sha as comment + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `event: ${{ github.event_name }}\n- github.event.pull_request.head.sha: ${{ github.event.pull_request.head.sha }}\n - github.sha: ${{ github.sha }}` + }) diff --git a/README.md b/README.md index fea088f2..350116dc 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ ### 1. pull_request +- `github.sha` is not the latest commit sha [ref](https://sue445.hatenablog.com/entry/2021/01/07/004835) +- `github.event.pull_request.head.sha` is the sha of the lastest commit [ref](https://github.com/orgs/community/discussions/26676) + |GitHub Actions|Trigger|Description| |---|---|---| |[actionlint](.github/workflows/actionlint.yml)| pull_request | [actionlint](https://github.com/rhysd/actionlint) lint for GitHub Actions workflows|