Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ex3_interact_with_github_api.yaml
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:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Install curl
shell: bash
run: |
sudo apt update && sudo apt install curl -y
- name: Shorten SHA
id: short_sha
env:
SHA: ${{ github.sha }}
run: echo "sha_short=${SHA::7}" >> "$GITHUB_ENV"
- name: Request Github API
shell: bash
run: |
echo "https://api.github.com/repos/${{ github.repository }}/issues"
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ env.sha_short }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ env.sha_short }}_."
}' \
--fail
24 changes: 24 additions & 0 deletions .github/workflows/ex3_switch_node_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Switch Node version
on:
pull_request:

jobs:
run-npm-test:
runs-on: ubuntu-latest
env:
NODE_VERSION: '14'
steps:
- name: checkout
uses: actions/checkout@v3
- name : setup node
uses: actions/setup-node@v3
with:
node-version: "${{ env.NODE_VERSION }}"
- name: run test
shell: bash
run: |
npm install
npm test
- name: show node version
shell: bash
run: node -v