Skip to content

Commit

Permalink
Merge 19caf03 into 270d62d
Browse files Browse the repository at this point in the history
  • Loading branch information
bogaertg committed Feb 24, 2023
2 parents 270d62d + 19caf03 commit bdd379b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ex3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Switch Node version
on:
pull_request:

jobs:
run-npm-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name : setup node
id: toto
uses: actions/setup-node@v3
with:
node-version: '14'
- name: run test
shell: bash
run: |
echo ${{ steps.toto.outputs.node-version }}
npm install
npm test
32 changes: 32 additions & 0 deletions .github/workflows/ex3_interact_with_github_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: interact with Github API
on:
pull_request:

jobs:
create-issue:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- id: short_sha
run: |
GITHUB_PR_SHA=${{github.event.pull_request.base.sha}}
echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
# echo "sha_short=${GITHUB_PR_SHA::7}" >> $GITHUB_OUTPUT
# - id: short_sha
# run: |
# echo "GITHUB_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
# USE {{env.GITHUB_SHA}} in next step

- name: Create issue using REST API
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ steps.short_sha.outputs.sha_short }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ steps.short_sha.outputs.sha_short }}_."
}' \
--fail

0 comments on commit bdd379b

Please sign in to comment.