How do I trigger a commit only for a particular user?

When a particular user commits, I want to automatically tag the commit, build and upload it to the release.
How do I write the yml?

You can use if: == ‘username_you_care_about’

Example workflow here:

Obviously your steps will be different but it should give you something to model with.

Thank you!
I get it!

It was not working for me.
Because, the particular user is not github user.
Committer is Weblate.
Like this

The variable refers to the GitHub user but in your case weblate is not a GitHub user. You can find the specifics of the supported variables here:

There is an action available called rlespinasse/git-commit-data-action which can extract the data you’re interested in and you can then use that to compare against. I’ve attached an example workflow below that will only release when the commit comes from weblate :slight_smile:

name: Release localization data

on: push

  # Create a job with the id `restrict` which obtains the committer name
    runs-on: ubuntu-latest
    # A job can expose output to another job
      # The value of `committer` is set (from env.GIT...) _after_ the job is done
      committer: ${{ env.GIT_COMMIT_COMMITTER_NAME }}
      - uses: actions/checkout@v2
      # This is the action that sets the value of `env.GIT_COMMIT_COMMITTER_NAME`
      - uses: rlespinasse/git-commit-data-action@v1.x
    # `needs` creates a dependency between jobs: this job won't run until
    # the `restrict` job is complete
    needs: restrict
    runs-on: ubuntu-latest
    # a job can access the outputs of a job it depends on through `needs`
    if: needs.restrict.outputs.committer == 'weblate'
      - name: Get current date
        id: date
        run: TZ=Asia/Tokyo echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')"

      - uses: actions/checkout@v2

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
          GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
          tag_name: v${{ }}
          release_name: v${{ }}

      - uses: actions/setup-python@v2

      - name: Install packages
        run: pip install vdf vpk

      - name: Build zip file
        run: python scripts/

      - name: Upload Release Asset
        uses: actions/upload-release-asset@v1
          GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./
          asset_content_type: application/zip