Create a GitHub Action and use it in a workflow.
Nice work adding a job to your workflow! 💃
Workflows have jobs, and jobs have steps. So now we'll add steps to your workflow.
What are steps?: Actions steps will run during our job in order. Each step is either a shell script that will be executed, or an action that will be run. Each step must pass for the next step to run. Actions steps can be used from within the same repository, from any other public repository, or from a published Docker container image.
In our action, we post a comment on the pull request using a bash script and GitHub CLI.
- Open your
welcome.yml
file. - Update the contents of the file to:
name: Post welcome comment on: pull_request: types: [opened] permissions: pull-requests: write jobs: build: name: Post welcome comment runs-on: ubuntu-latest steps: - run: gh pr comment $PR_URL --body "Welcome to the repository!" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_URL: ${{ github.event.pull_request.html_url }}
- Click Start commit in the top right of the workflow editor.
- Type your commit message and commit your changes directly to your branch.
- Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.
Get help: Post in our discussion board • Review the GitHub status page
© 2023 GitHub • Code of Conduct • MIT License