Update add-comment.yml #23
This file contains 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: add comment on issue | |
on: | |
pull_request: | |
issues: | |
- opened | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
comment_issue: | |
if: contains( github.event.issue.labels.*.name, 'bug') | |
permissions: | |
issues: write | |
name: comment-issue-job | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: create a comment with git cli | |
run: | | |
gh issue comment ${{ github.event.issue.number }} --body "This is my test comment created with a workflow using github cli" | |
- name: logging debugging informations | |
run: | | |
echo "${{ github.event.issue.number }}" | |
- name: create a comment with github action | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'created a comment using github action!' | |
}) | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Dump job context | |
env: | |
JOB_CONTEXT: ${{ toJson(job) }} | |
run: echo "$JOB_CONTEXT" | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Dump runner context | |
env: | |
RUNNER_CONTEXT: ${{ toJson(runner) }} | |
run: echo "$RUNNER_CONTEXT" | |
- name: Dump strategy context | |
env: | |
STRATEGY_CONTEXT: ${{ toJson(strategy) }} | |
run: echo "$STRATEGY_CONTEXT" | |
- name: Dump matrix context | |
env: | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} | |
run: echo "$MATRIX_CONTEXT" | |
- name: Show default environment variables | |
run: | | |
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables | |
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables | |
echo "The run id is: $GITHUB_RUN_ID" | |
echo "The GitHub Actor's username is: $GITHUB_ACTOR" | |
echo "GitHub SHA: $GITHUB_SHA" |