diff --git a/.github/workflows/DevelopInBranch.yml b/.github/workflows/DevelopInBranch.yml new file mode 100644 index 0000000..f48823b --- /dev/null +++ b/.github/workflows/DevelopInBranch.yml @@ -0,0 +1,27 @@ +# workflow to show how to develop workflows in branches +name: Develop in a branch +on: [pull_request, workflow_dispatch] + +jobs: + job1: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - run: | + echo "Workflow triggered in branch '${{ github.ref }}'." + echo "Workflow triggered by event '${{ github.event_name }}'." + echo "Workflow triggered by actor '${{ github.actor }}''." + # - uses: actions/checkout@v4.2.2 + # - uses: devops-actions/actionlint@v0.1.3 + # - run: echo "PR title is '${{ github.event.pull_request.title }}'." + - run: | + echo "::debug::This is a debug message." + echo "::notice::This is a notice message." + echo "::warning::This is a warning message." + echo "::error::This is an error message." + - run: | + echo "::notice file=.github/workflows/DevelopInBranch.yml,line=19,col=11,endColumn=51::There is a debug message that is not always visible!" + echo "::warning file=.github/workflows/DevelopInBranch.yml,line=19,endline=21::A lot of messages" + echo "::error title=Script Injection,file=.github/workflows/DevelopInBranch.yml,line=13,col=37,endColumn=68::Potential script injection" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4aa1667 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: Action CI +on: [push] + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + - name: Run my own container action + id: my-action + uses: ./ + with: + who-to-greet: '@howsen82' + - name: Test the container + if: ${{ steps.my-action.outputs.answer != 42 }} + run: | + echo "::error file=entrypoint.sh,line=4,title=Error in container::The answer was not expected" + exit 1 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..262fef3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Container image that runs your code +# FROM alpine:latest +# CMD echo "Hello World" +FROM alpine:3.21 + +COPY entrypoint.sh /entrypoint.sh + +RUN chmod +x entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +# docker run $(docker build -q .) \ No newline at end of file diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..9d309aa --- /dev/null +++ b/action.yml @@ -0,0 +1,15 @@ +name: 'Docker Action Recipe' +description: 'Greet someone' +inputs: + who-to-greet: + description: 'Who to greet' + required: true + default: 'World' +outputs: + answer: + description: 'The answer to everything (always 42)' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.who-to-greet }} \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..bb43cd6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh -l +echo "Hello $@" +echo "answer=42" >> $GITHUB_OUTPUT +echo "### Hello $@! :rocket:" >> $GITHUB_STEP_SUMMARY +echo "